<template>
	<div :style="{ height: `calc(100vh - ${initTagViewHeight}` }">
		<div class="layout-view-bg-white">
			<div id="left-panel" class="" style="height: 552px">
				<div id="searchbox" class="clearfix">
					<div id="searchbox-container" style="width: 340px">
						<div id="sole-searchbox-content" class="searchbox-content">
							<input
								@click="searchBoxFocus"
								v-model="searchContent.address"
								id="sole-input"
								class="searchbox-content-common"
								type="text"
								name="word"
								autocomplete="off"
								maxlength="256"
								placeholder="搜地点"
							/>
							<div class="input-clear" title="清空" style="display: block" @click="closeSearchContent"></div>
							<div
								v-if="false"
								class="searchbox-content-button right-button route-button loading-button"
								data-title="疏散路线"
								@click="clickGhLuxian"
							></div>
							<!--搜索提示从数据库查找start-->
							<div
								v-if="isShowSearchSug"
								class="ui3-suggest-wrap"
								id="ui3-suggest-wrap"
								style="top: 40.9962px; z-index: 1000; display: block; overflow-y: auto; max-height: 552px"
							>
								<div id="ui3-suggest-scroll" style="width: 368px">
									<div @click="setSearchInput(sugItem)" class="ui3-suggest-item" v-for="sugItem in searchSugItems" :key="sugItem.address">
										<a>
											<i class="default">{{ sugItem.address }}</i></a
										>
									</div>
								</div>
							</div>
							<!--搜索提示从数据库查找end-->
							<!--搜索起终点提示从数据库查找start-->
							<div v-if="isShowQizhongSug" class="ui3-suggest-wrap" id="ui3-suggest-wrap" style="top: 155.9962px; z-index: 1000; display: block">
								<div id="ui3-suggest-scroll" style="width: 368px">
									<div @click="setQizhongdianInput(sugItem)" class="ui3-suggest-item" v-for="sugItem in searchSugItems" :key="sugItem.address">
										<a
											><i class="default">{{ sugItem.address }}</i></a
										>
									</div>
								</div>
							</div>
							<!--搜索起终点提示从数据库查找end-->
						</div>
					</div>
					<!-- <button class="searchLeft" id="search-button" data-title="搜索" @click="searchAddr"></button> -->
					<div id="toast-wrapper">
						<div id="toast">
							<img class="info-tip-img" src="/static/images/transparent.gif" alt="" />
							<span class="info-tip-text"> </span>
						</div>
					</div>
				</div>
				<ul id="cards-level0" class="cardlist"></ul>
				<ul id="cards-level1" class="cardlist"></ul>
				<ul id="cards-level2" class="cardlist"></ul>
			</div>
			<div class="appRightTop">
				<div id="user-center" class="ui3-user-center-wrap" style="visibility: visible">
					<div class="avatar-abstract" style="background-image: url('/static/images/857a6c6863626470616e47cf.jpg')"></div>
					<div class="info-box clearfix" style="display: none">
						<div class="arrow"></div>
					</div>
				</div>
				<div id="tool-container" class="toolscontainer flex">
					<!-- <div class="w-72 mr-4">
						<el-select :popper-append-to-body="false" v-model="optValue" multiple placeholder="图层选择" clearable @change="onChangeOpt">
							<el-option v-for="item in cities" :key="item.value" :label="item.label" :value="item.value" />
							<template #prefix>
								<img alt="图标" class="w-4 h-4" style="padding: 0px; margin: 0px" src="/favicon.ico" />
							</template>
						</el-select>
					</div> -->
					<el-select :popper-append-to-body="false" v-model="toolOptValue" class="w-40" placeholder="工具" clearable @change="onChangeToolOpt">
						<el-option v-for="item in toolOptions" :key="item.value" :label="item.label" :value="item.value" />
						<template #prefix>
							<i class="icon-gongju iconfont"></i>
						</template>
					</el-select>
					<div class="w-4"></div>
					<el-button v-if="isSave && schemeId == 0" style="height: 40px" type="success" plain @click="addScheme">新增方案</el-button>
					<el-button v-if="isSave && schemeId > 0" style="height: 40px" type="success" plain @click="saveScheme">保存方案</el-button>
				</div>
			</div>
			<div id="echartsMap" style="height: 100%"></div>
		</div>
		<el-dialog
			draggable
			ref="elybdymapDialog"
			:title="dialogStatus == 'create' ? '创建' : '编辑'"
			v-model="dialogFormVisible"
			customClass="customWidth"
		>
			<el-form ref="dataForm" :rules="rules" :model="tempArticleModel" label-position="left" label-width="60px" style="width: 350px">
				<el-form-item :label="t('message.layout.title')" prop="title">
					<el-input v-model="tempArticleModel.title" placeholder="名称为唯一标示,必须与已有不同" />
				</el-form-item>
				<el-row style="margin-bottom: 20px">
					<el-col :span="12">
						<el-form-item label="联系" prop="reviewer">
							<el-input v-model="tempArticleModel.reviewer" placeholder="填写" />
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item :label="t('message.layout.phone')" prop="timestamp">
							<el-input v-model="tempArticleModel.timestamp" placeholder="填写" />
						</el-form-item>
					</el-col>
				</el-row>
				<el-row style="margin-bottom: 20px">
					<el-col :span="12">
						<el-form-item label="区域" prop="status">
							<el-select v-model="tempArticleModel.status" class="filter-item" placeholder="请选择">
								<el-option v-for="item in statusOptions" :key="item" :label="item" :value="item" />
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item :label="t('message.layout.location')" prop="jingbaoqiWeizhi">
							<el-input v-model="jingbaoqiWeizhi" />
						</el-form-item>
					</el-col>
				</el-row>
				<!-- 增加如下 -->
				<el-form-item v-if="toolOptValue.substring(1) == '防空警报点' || jingbaoqiUpdate " label="类型" prop="type">
					<el-select v-model="tempArticleModel.jingbaoqiType" class="filter-item" placeholder="请选择">
						<el-option v-for="item in jingbaoqiOptions" :key="item" :label="item" :value="item" />
					</el-select>
				</el-form-item>
				<el-form-item label="备注" prop="fullContent">
					<el-input v-model="tempArticleModel.fullContent" :autosize="{ minRows: 2, maxRows: 4 }" type="textarea" placeholder=" 信息" />
				</el-form-item>
			</el-form>
			<div class="dialog-footer">
				<el-button @click="dialogFormVisible = false">
					{{ t('message.layout.cancel') }}
				</el-button>
				<el-button type="primary" @click="dialogStatus === 'create' ? createData() : updateData()">
					{{ t('message.layout.confirm') }}
				</el-button>
				<el-button type="primary" @click="handleDelete()">
					{{ t('message.layout.delete') }}
				</el-button>
			</div>
		</el-dialog>
		<el-dialog v-model="searchDianPopVisible" title="创建搜索点">
			<el-form label-position="left" label-width="60px" style="width: 350px">
				<el-form-item label="地名">
					<el-input v-model="addsearchName" placeholder="请输入地名" />
				</el-form-item>
			</el-form>
			<div class="h-5"></div>
			<div class="dialog-footer">
				<el-button @click="searchDianPopVisible = false">
					{{ t('message.layout.cancel') }}
				</el-button>
				<el-button type="primary" @click="tapAddSearchDian"> 添加 </el-button>
			</div>
		</el-dialog>
		<ZhanbeiDialog
			@delData="delZhanbei"
			@updateData="updateZhanbei"
			@createData="createZhanbei"
			@clearNewDian="clearNewZhanbei"
			ref="dialogPop"
			v-model="zhanbeiVisible"
			v-model:dialogStatus="zhanbeiDialogStatus"
		></ZhanbeiDialog>
		<ZhuanyeDialog
			@delData="delZhuanye"
			@updateData="updateZhuanye"
			@createData="createZhuanye"
			@clearNewDian="clearNewZhuanye"
			ref="zhuanyedialogPop"
			v-model="zhuanyeVisible"
			v-model:dialogStatus="zhuanyeDialogStatus"
		></ZhuanyeDialog>
		<ZhihuiDialog
			@delData="delZhihui"
			@updateData="updateZhihui"
			@createData="createZhihui"
			@clearNewDian="clearNewZhihui"
			ref="zhihuidialogPop"
			v-model="zhihuiVisible"
			v-model:dialogStatus="zhihuiDialogStatus"
		></ZhihuiDialog>
		<ComplexDialog
			@delData="delJingji"
			@updateData="updateJingji"
			@createData="createJingji"
			@clearNewDian="clearNewJIngji"
			ref="jingjidialogPop"
			v-model="jingjiVisible"
			v-model:dialogStatus="jingjiDialogStatus"
		></ComplexDialog>
		<SchemeDialog
			@delData="delScheme"
			@updateData="updateScheme"
			@createData="createScheme"
			ref="shcemedialogPop"
			v-model="schemeVisible"
			v-model:dialogStatus="schemeDialogStatus"
		></SchemeDialog>
		<Contextmenu :dropdown="dropdownNode" ref="contextmenuNodeRef" @current="onRightMenu" />
		<div class="flex flex-row-reverse w-full h-full pointer-events-none fixed inset-0 z-10">
			<el-drawer
				v-model="singledrawer"
				direction="rtl"
				size="200"
				:modal="false"
				modal-class="mask-layer"
				@opened="onOpenDrawer"
				@close="foldBtnVisible = false"
				:with-header="false"
			>
				<div class="flex h-full relative w-full">
					<el-tree
						ref="treeRef"
						:data="treeArr"
						show-checkbox
						node-key="id"
						:props="treeProps"
						@check-change="handleCheckChange"
						@check="checkChange"
						@node-contextmenu="handleTreeContextMenu"
						:check-on-click-node="false"
						accordion
						:default-expanded-keys="expandedArr"
					/>
				</div>
			</el-drawer>
			<div v-if="foldBtnVisible" class="h-full flex items-center z-50 fixed pointer-events-auto top-0" style="width: 30px; right: 200px">
				<el-image src="/static/images/icons/fold.png" :fit="contain" @click="singledrawer = false" />
			</div>
		</div>
		<div v-if="!foldBtnVisible" class="h-full flex items-center z-50 fixed pointer-events-auto top-0" style="width: 30px; right: 0px">
			<el-image src="/static/images/icons/unfold.png" :fit="contain" @click="singledrawer = true" />
		</div>
	</div>
</template>
<script lang="ts">
import { onUnmounted, toRefs, reactive, computed, onMounted, getCurrentInstance, watch, nextTick, ref, unref } from 'vue';
import * as echarts from 'echarts';
import 'echarts/extension/bmap/bmap';
import '/@/assets/baidumaptools.css';
import '/@/assets/baidupage.css';
import { useStore } from '/@/store/index';
import { echartsMapList, echartsMapData } from './mock';
import { createArticle, deleteArticle, deleteArticleByName, updateArticle, defaultArticleModel, ArticleType, getArticles } from '/@/request/articles';
import { ElForm, ElMessage } from 'element-plus';
import { useI18n } from 'vue-i18n';
import { cloneDeep } from 'lodash';
import { useRouter } from 'vue-router';
import Assert from '/@/utils/shf/Assert';
import AllMap from '/@/utils/shf/AllMap';
import { deepClone } from '/@/utils/deepClone';
import { ElLoading } from 'element-plus';
import ZhanbeiDialog from '../../../views/table/components/ZhanbeiDialog.vue';
import ZhuanyeDialog from '../../../views/table/components/ZhuanyeDialog.vue';
import ZhihuiDialog from '../../../views/table/components/ZhihuiDialog.vue';
import ComplexDialog from '../../../views/table/components/ComplexDialog.vue';
import SchemeDialog from '../../../views/yuanFangAn/components/SchemeDialog.vue';
import DebounceUnit from '/@/utils/shf/DebounceUnit';
import Contextmenu from './component/index.vue';
import HttpReqApi from '/@/utils/shf/http/HttpReqApi';
import StrUnit from '/@/utils/shf/StrUnit';
import { prov_boundary } from '../../visualizing/js/shouxian';
export default {
	name: 'ybdyMap',
	components: { ZhanbeiDialog, ZhuanyeDialog, ZhihuiDialog, ComplexDialog, Contextmenu, SchemeDialog },
	setup() {
		let schemeBack: any = null;
		const optValueBefore: any[] = [];
		let isContextMenu = false;
		const debounceUnit = new DebounceUnit();
		const dialogPop = ref(null);
		const zhuanyedialogPop = ref(null);
		const zhihuidialogPop = ref(null);
		const jingjidialogPop = ref(null);
		const contextmenuNodeRef = ref(null);
		const shcemedialogPop = ref(null);
		const treeRef = ref();
		const optValue: { value: any } = ref([]);
		const toolOptValue = ref('');
		const beforeToolOptValue = ref('');
		const { t } = useI18n();
		const store = useStore();
		const { proxy } = getCurrentInstance();
		const router = useRouter();
		const addSearchPos = { lng: 0, lat: 0 };
		let currentSugItems: any = null;
		let movePnt = { name: '', seriesName: '' };
		const dataForm = ref(ElForm);
		const state = reactive({
			schemeData: { id: 0, creatTime: '', titleContent: '' },
			schemeId: 0,
			isSave: false,
			dropdownNode: { x: 0, y: 0 },
			addsearchName: '',
			searchDianPopVisible: false,
			zhuanyeVisible: false,
			zhanbeiVisible: false,
			zhihuiVisible: false,
			jingjiVisible: false,
			schemeVisible: false,
			zhanbeiDialogStatus: '',
			zhuanyeDialogStatus: '',
			zhihuiDialogStatus: '',
			jingjiDialogStatus: '',
			schemeDialogStatus: '',
			jingbaoqiUpdate: false,
			cities: [
				{
					value: '集结点',
					label: '集结点',
				},
				{
					value: '疏散路线',
					label: '疏散路线',
				},
				{
					value: '疏散地域',
					label: '疏散地域',
				},
				{
					value: '隐蔽地域',
					label: '隐蔽地域',
				},
				{
					value: '防空警报点',
					label: '防空警报点',
				},
				{
					value: '保障点',
					label: '保障点',
				},
				{
					value: '物资点',
					label: '物资点',
				},
				{
					value: '队伍点',
					label: '队伍点',
				},
				{
					value: '人防点',
					label: '人防点',
				},
				{
					value: '经济目标',
					label: '经济目标',
				},
				{
					value: '方案',
					label: '方案',
				},
			],
			toolOptions: [
				{
					value: '加集结点',
					label: '加集结点',
				},
				{
					value: '加疏散路线',
					label: '加疏散路线',
				},
				{
					value: '加疏散地域',
					label: '加疏散地域',
				},
				{
					value: '加隐蔽地域',
					label: '加隐蔽地域',
				},
				{
					value: '加防空警报点',
					label: '加防空警报点',
				},
				{
					value: '加保障点',
					label: '加保障点',
				},
				{
					value: '加物资点',
					label: '加物资点',
				},
				{
					value: '加队伍点',
					label: '加队伍点',
				},
				{
					value: '加人防点',
					label: '加人防点',
				},
				{
					value: '加经济目标',
					label: '加经济目标',
				},
				{
					value: '加方案',
					label: '加方案',
				},
			],
			uptDelContext: {},
			isShowSelectItem: false,
			allSelectItems: ['集结点', '疏散路线', '疏散地域', '隐蔽地域', '防空警报点'],
			dialogStatus: '',
			rules: {
				title: [{ required: true, message: 'title is required', trigger: 'blur' }],
				status: [{ required: true, message: 'area is required', trigger: 'change' }],
			},
			statusOptions: ['市人防', '市防疫', '区人防'],
			jingbaoqiOptions: ['多媒体','电声一体','电声'],
			tempArticleModel: defaultArticleModel,
			dialogFormVisible: false,
			pageType: proxy.$route.query.type,
			pageName: proxy.$route.query.name,
			echartsMapList,
			echartsMapData,
			curRouteIndex: 'bus',
			showLuxian: false,
			showToolsBox: false,
			isMarkActive: false,
			isShouhuiActive: false,
			searchContent: {
				address: '',
				longitude: 0.0,
				latitude: 0.0,
			},
			isSetsearchContent: false,
			isSetqizhongContent: false,
			startGhLuxian: {
				address: '',
				longitude: 0.0,
				latitude: 0.0,
			},
			endGhLuxian: {
				address: '',
				longitude: 0.0,
				latitude: 0.0,
			},
			bmap: {},
			searchSugItems: [],
			isShowSearchSug: false,
			isShowQizhongSug: false,
			isStartLuxianFocus: false,
			isEndLuxianFocus: false,
			pagedata: {
				currentPage: 1,
				pageCount: 1000,
			},
			nullSugItem: {
				address: '警告!!无此POI数据',
				longitude: 0.0,
				latitude: 0.0,
			},
			curSearchPoint: {},
			curSearchMarker: {},
			startGhLuxianPoint: {},
			endGhLuxianPoint: {},
			ghLuxianPolyline: {},
			bmapPoints: [],
			bmapOverlays: [],
			getTblData: {},
			/////////////////集结点.etc//////////////
			jijieDian: [],
			schemelines: [],
			wuziDian: [],
			zhanyeDian: [],
			zhihuiDian: [],
			baozhangDian: [],
			supportDian: [],
			jingjiDian: [],
			shusanLuxianData: [],
			luxianDian: [],
			currentLxDian: [],
			shusandiyuDian: [],
			currentSsdyDian: [],
			shusanDiyuData: [],
			yinbidiyuDian: [],
			currentYbdyDian: [],
			yinbiDiyuData: [],
			isMouseDown: false,
			myChart: {},
			singledrawer: false,
			foldBtnVisible: false,
			treeArr: [
				{
					id: StrUnit.getUUID(),
					children: [
						{ id: StrUnit.getUUID(), children: [], name: '集结点' },
						{ id: StrUnit.getUUID(), children: [], name: '保障点' },
						{ id: StrUnit.getUUID(), children: [], name: '疏散路线' },
						{ id: StrUnit.getUUID(), children: [], name: '疏散地域' },
						{ id: StrUnit.getUUID(), children: [], name: '隐蔽地域' },
						{
							id: StrUnit.getUUID(),
							children: [
								{ id: StrUnit.getUUID(), children: [], name: '多媒体警报器' },
								{ id: StrUnit.getUUID(), children: [], name: '电声一体机警报器' },
								{ id: StrUnit.getUUID(), children: [], name: '电声警报器' },
							],
							name: '防空警报点',
						},
						{ id: StrUnit.getUUID(), children: [], name: '物资点' },
						{ id: StrUnit.getUUID(), children: [], name: '队伍点' },
						{ id: StrUnit.getUUID(), children: [], name: '人防点' },
						{ id: StrUnit.getUUID(), children: [], name: '经济目标' },
						{ id: StrUnit.getUUID(), children: [], name: '方案' },
					],
					name: '图层列表',
				},
			],
			treeProps: { children: 'children', label: 'name', disabled: 'disabled' },
			expandedArr: [],
		});

const jingbaoqiWeizhi = computed({
  get: () => {
    return (toolOptValue.value.substring(1) === '防空警报点' || state.jingbaoqiUpdate)
      ? state.tempArticleModel.abstractContent
      : state.tempArticleModel.pageviews;
  },
  set: (val) => {
    if (toolOptValue.value.substring(1) === '防空警报点' || state.jingbaoqiUpdate) {
		state.tempArticleModel.abstractContent = val;
    } else {
		state.tempArticleModel.pageviews = val;
    }
  }
});
		const dftSeriesLinesData = {
			name: 'tempLinesDataNameLhc',
			coords: [],
		};
		const dftSeriesScatterDataName = 'tempScatterDataNameLhc';
		/*
		watch((event)=>event.currentTarget.getAttribute('map-on-click'),(val)=>{
		});
*/
		//监测搜索栏输入内容变化，实时搜索
		watch(
			() => state.searchContent.address,
			async (val) => {
				if (state.isSetsearchContent) {
					state.isSetsearchContent = false;
				} else {
					if (val.length > 0) {
						state.pagedata.address = val;
						state.searchSugItems = [];
						state.treeArr[0].children.forEach((subArray) => {
							subArray.children.forEach((obj) => {
								if (obj.name.includes(val) || obj.name == val) {
									let currentSugItems = {
										address: obj.name,
										longitude: obj.lng,
										latitude: obj.lat,
										key: obj.id,
										importance: obj.importance,
									};
									state.searchSugItems.push(currentSugItems);
								}
							});
						});
						await getArticles(state.pagedata, ArticleType.MAPPOI).then((res) => {
							for (let i = 0; res.data[i]; i++) {
								state.searchSugItems.push(res.data[i]);
								currentSugItems = res.data[i];
							}
						});
						state.isShowSearchSug = true;
					} else {
						state.isShowSearchSug = false;
					}
				}
			}
		);
		watch(
			() => state.startGhLuxian.address,
			async (val) => {
				if (state.isSetqizhongContent) {
					state.isSetqizhongContent = false;
				} else {
					if (val.length > 1) {
						state.pagedata.address = val;
						await getArticles(state.pagedata, ArticleType.MAPPOI).then((res) => {
							state.searchSugItems = [];
							for (let i = 0; res.data[i]; i++) {
								state.searchSugItems.push(res.data[i]);
								currentSugItems = res.data[i];
							}
							if (state.searchSugItems.length == 0) {
								state.searchSugItems.push(state.nullSugItem);
							}
						});
						state.isShowQizhongSug = true;
					} else {
						state.isShowQizhongSug = false;
						state.startGhLuxian.longitude = 0.0;
						state.startGhLuxian.latitude = 0.0;
						if (state.ghLuxianPolyline) {
							state.bmap.removeOverlay(state.ghLuxianPolyline);
							delete state.ghLuxianPolyline;
						}
					}
				}
			}
		);
		watch(
			() => state.endGhLuxian.address,
			async (val) => {
				if (state.isSetqizhongContent) {
					state.isSetqizhongContent = false;
				} else {
					if (val.length > 1) {
						state.pagedata.address = val;
						await getArticles(state.pagedata, ArticleType.MAPPOI).then((res) => {
							state.searchSugItems = [];
							for (let i = 0; res.data[i]; i++) {
								state.searchSugItems.push(res.data[i]);
								currentSugItems = res.data[i];
							}
							if (state.searchSugItems.length == 0) {
								state.searchSugItems.push(state.nullSugItem);
							}
						});
						state.isShowQizhongSug = true;
					} else {
						state.isShowQizhongSug = false;
						state.endGhLuxian.longitude = 0.0;
						state.endGhLuxian.latitude = 0.0;
						if (state.ghLuxianPolyline) {
							state.bmap.removeOverlay(state.ghLuxianPolyline);
							delete state.ghLuxianPolyline;
						}
					}
				}
			}
		);
		watch(
			() => state.dialogFormVisible,
			(val) => {
				if (!val) {
					if (state.dialogStatus == 'create') {
						clearTmpDian(toolOptValue.value.substring(1));
					}
				}
			}
		);
		const clearTmpDian = (status: string) => {
			let delDian = [];
			switch (status) {
				case '集结点':
					{
						for (let i = 0; i < state.jijieDian.length; i++) {
							let ele = state.jijieDian[i];
							if (ele.name == '') {
								delDian.push(i);
								break;
							}
						}
						let j = 0;
						delDian.forEach((ele) => {
							state.jijieDian.splice(ele - j, 1);
							j++;
						});
						if (j) {
							AllMap.updateGroups(optValueBefore, state, '集结点');
						}
					}
					break;
				case '防空警报点':
					{
						for (let i = 0; i < state.baozhangDian.length; i++) {
							let ele = state.baozhangDian[i];
							if (ele.name == '') {
								delDian.push(i);
								break;
							}
						}
						let j = 0;
						delDian.forEach((ele) => {
							state.baozhangDian.splice(ele - j, 1);
							j++;
						});
						if (j) {
							AllMap.updateGroups(optValueBefore, state, '防空警报点');
						}
					}
					break;
				case '保障点':
					{
						for (let i = 0; i < state.supportDian.length; i++) {
							let ele = state.supportDian[i];
							if (ele.name == '') {
								delDian.push(i);
								break;
							}
						}
						let j = 0;
						delDian.forEach((ele) => {
							state.supportDian.splice(ele - j, 1);
							j++;
						});
						if (j) {
							AllMap.updateGroups(optValueBefore, state, '保障点');
						}
					}
					break;
				case '疏散路线':
					{
						//路线点
						delDian = [];
						for (let i = 0; i < state.luxianDian.length; i++) {
							let ele = state.luxianDian[i];
							if (ele.name == dftSeriesLinesData.name) {
								delDian.push(i);
							}
						}
						let j = 0;
						delDian.forEach((ele) => {
							state.luxianDian.splice(ele - j, 1);
							j++;
						});
						if (j) {
							AllMap.updateGroups(optValueBefore, state, '路线点');
						}
						//路线
						delDian = [];
						for (let i = 0; i < state.shusanLuxianData.length; i++) {
							let ele = state.shusanLuxianData[i];
							if (ele.name == dftSeriesLinesData.name) {
								delDian.push(i);
								break;
							}
						}
						let k = 0;
						delDian.forEach((ele) => {
							state.shusanLuxianData.splice(ele - k, 1);
							k++;
						});
						if (k) {
							AllMap.updateGroups(optValueBefore, state, '疏散路线');
						}
					}
					break;
				case '疏散地域':
					{
						//地域点
						delDian = [];
						for (let i = 0; i < state.shusandiyuDian.length; i++) {
							let ele = state.shusandiyuDian[i];
							if (ele.name == dftSeriesLinesData.name) {
								delDian.push(i);
							}
						}
						let j = 0;
						delDian.forEach((ele) => {
							state.shusandiyuDian.splice(ele - j, 1);
							j++;
						});
						if (j) {
							AllMap.updateGroups(optValueBefore, state, '疏散地域点');
						}
						//地域
						delDian = [];
						for (let i = 0; i < state.shusanDiyuData.length; i++) {
							let ele = state.shusanDiyuData[i];
							if (ele.name == dftSeriesLinesData.name) {
								delDian.push(i);
								break;
							}
						}
						let k = 0;
						delDian.forEach((ele) => {
							state.shusanDiyuData.splice(ele - k, 1);
							k++;
						});
						if (k) {
							AllMap.updateGroups(optValueBefore, state, '疏散地域');
						}
						beforeToolOptValue.value = '';
						toolOptValue.value = '';
					}
					break;
				case '隐蔽地域':
					{
						//地域点
						delDian = [];
						for (let i = 0; i < state.yinbidiyuDian.length; i++) {
							let ele = state.yinbidiyuDian[i];
							if (ele.name == dftSeriesLinesData.name) {
								delDian.push(i);
							}
						}
						let j = 0;
						delDian.forEach((ele) => {
							state.yinbidiyuDian.splice(ele - j, 1);
							j++;
						});
						if (j) {
							AllMap.updateGroups(optValueBefore, state, '隐蔽地域点');
						}
						//地域
						delDian = [];
						for (let i = 0; i < state.yinbiDiyuData.length; i++) {
							let ele = state.yinbiDiyuData[i];
							if (ele.name == dftSeriesLinesData.name) {
								delDian.push(i);
								break;
							}
						}
						let k = 0;
						delDian.forEach((ele) => {
							state.yinbiDiyuData.splice(ele - k, 1);
							k++;
						});
						if (k) {
							AllMap.updateGroups(optValueBefore, state, '隐蔽地域');
						}
						beforeToolOptValue.value = '';
						toolOptValue.value = '';
					}
					break;
			}
		};
		const addScheme = async () => {
			if (state.schemelines.length <= 0) {
				Assert.isFalse(true, '方案无内容');
				return;
			}
			state.schemeVisible = true;
			state.schemeDialogStatus = 'create';
			(shcemedialogPop as any).value.handleCreate();
		};
		const saveScheme = async () => {
			state.schemeVisible = true;
			state.schemeDialogStatus = 'update';
			(shcemedialogPop as any).value.handleUpdate(state.schemeData, false);
		};
		const createScheme = async (tempArticleModel) => {
			// let joinContent = {schemelines:JSON.stringify(state.schemelines),dian:};
			let dianTitleArr = AllMap.getDianTitleInScheme(state);
			let joinContent = JSON.stringify({ schemelines: state.schemelines, dianTitleArr });
			let res: any = await HttpReqApi.addHelpscheme({ ...tempArticleModel, joinContent });
			state.schemeData.id = res.id;
			state.schemeData.creatTime = res.creatTime;
			state.schemeData.titleContent = res.titleContent;
			state.schemeId = res.id;
			ElMessage.success({
				message: '提交成功',
				type: 'success',
				duration: 2000,
			});
		};
		const updateScheme = async (tempArticleModel) => {
			let dianTitleArr = AllMap.getDianTitleInScheme(state);
			let joinContent = JSON.stringify({ schemelines: state.schemelines, dianTitleArr });
			await HttpReqApi.updateHelpscheme({ ...tempArticleModel, joinContent });
			state.schemeData.creatTime = tempArticleModel.creatTime;
			state.schemeData.titleContent = tempArticleModel.titleContent;
			ElMessage.success({
				message: '修改成功',
				type: 'success',
				duration: 2000,
			});
		};
		const tapAddSearchDian = async () => {
			if (state.addsearchName == '') {
				Assert.isFalse(true, '未输入地名');
				return;
			}
			const articleId = await createArticle(
				{ address: state.addsearchName, longitude: '' + addSearchPos.lng, latitude: addSearchPos.lat },
				ArticleType.MAPPOI
			);
			state.searchDianPopVisible = false;
			ElMessage.success('添加成功');
		};
		const setSelectItem = (selItem) => {
			state.isShowSelectItem = false;
			let str = '/menu/menu1/menu12/menu121';
			switch (selItem) {
				case '集结点':
					{
						str = '/menu/menu1/menu12/menu121';
					}
					break;
				case '疏散路线':
					{
						str = '/menu/menu1/menu12/menu122';
					}
					break;
				case '疏散地域':
					{
						str = '/menu/menu1/menu12/menu123';
					}
					break;
				case '隐蔽地域':
					{
						str = '/menu/menu1/menu12/menu124';
					}
					break;
				case '防空警报点':
					{
						str = '/menu/menu1/menu12/menu125';
					}
					break;
				case '经济目标':
					{
						str = '/menu/menu1/menu12/menu126';
					}
					break;
			}
			router.push({
				path: str,
				query: { type: selItem, name: '' },
			});
		};
		const searchBoxFocus = () => {
			if (state.showLuxian) state.showLuxian = false;
			if (state.showToolsBox) state.showToolsBox = false;
		};
		const startGhLuxianFocus = () => {
			state.isStartLuxianFocus = true;
			state.isEndLuxianFocus = false;
		};
		const endGhLuxianFocus = () => {
			state.isStartLuxianFocus = false;
			state.isEndLuxianFocus = true;
		};
		const setSearchInput = async (sugItem) => {
			state.isShowSearchSug = false;
			if (sugItem.longitude != 0.0) {
				state.isSetsearchContent = true;
				state.searchContent = sugItem;
				state.curSearchPoint.lng = sugItem.longitude;
				state.curSearchPoint.lat = sugItem.latitude;
				state.bmap.centerAndZoom(state.curSearchPoint, window['bdmapLevel']);
				if (sugItem.key) {
					let treeRef = proxy.$refs.treeRef;
					let currentlyCheckedKeys = proxy.$refs.treeRef.getCheckedKeys();
					// let newKeys = [/* 新的 keys 数组 */];
					// 合并当前选中的 keys 与新的 keys，使用 Set 来去除重复的 keys
					let combinedKeys = [...new Set([...currentlyCheckedKeys, sugItem.key])];
					treeRef.setCheckedKeys(combinedKeys);
					const checkedNodes = proxy.$refs.treeRef.getCheckedNodes();
					const halfCheckedNodes = proxy.$refs.treeRef.getHalfCheckedNodes();
					optValue.value = [];
					for (const vo of checkedNodes) {
						let { id, name, isleaf } = vo;
						if (isleaf) continue;
						if (name == '图层列表') continue;
						optValue.value.push(name);
					}
					for (const vo of halfCheckedNodes) {
						let { id, name, isleaf } = vo;
						if (isleaf) continue;
						if (name == '图层列表') continue;
						optValue.value.push(name);
					}
					//延时1s
					setTimeout(() => {
						onChangeOpt(optValue.value);
					}, 1000);
				} else {
					// 非疏散要素
					// 创建标注
					state.curSearchMarker.point = state.curSearchPoint;
					state.bmap.addOverlay(state.curSearchMarker);
				}
			}
		};
		const closeSearchContent = () => {
			state.searchContent.address = '';
			state.searchContent.longitude = state.searchContent.latitude = 0.0;
			state.bmap.removeOverlay(state.curSearchMarker);
		};
		const handleCheckChange = (data: any, checked: boolean, indeterminate: boolean) => {
			let { id, name, isleaf, importance } = data;
			if (isleaf && importance) {
				if (checked) {
					AllMap.displayOne(state, name, importance);
				} else {
					AllMap.hideOne(state, name, importance);
				}
			}
		};
		const checkChange = (e1, e2) => {
			// AllMap.updateChangeDisplay(state);
			let checkedNodes = e2.checkedNodes;
			let halfCheckedNodes = e2.halfCheckedNodes;
			optValue.value.splice(0, optValue.value.length);
			for (const vo of checkedNodes) {
				let { id, name, isleaf } = vo;
				if (isleaf) continue;
				if (name == '图层列表') continue;
				optValue.value.push(name);
			}
			for (const vo of halfCheckedNodes) {
				let { id, name, isleaf } = vo;
				if (isleaf) continue;
				if (name == '图层列表') continue;
				optValue.value.push(name);
			}
			onChangeOpt(optValue.value);
		};
		//右击节点事件
		const handleTreeContextMenu = (e1, e2) => {
			let { id, name, lng, lat } = e2;
			if (lat && lng) {
				let point = new BMap.Point(lng, lat);
				(state.bmap as any).centerAndZoom(point, window['bdmapLevel']);
			}
		};
		const onOpenDrawer = () => {
			state.foldBtnVisible = true;
			treeUpdate();
		};
		const treeUpdate = () => {
			let treeRef = proxy.$refs.treeRef;
			treeRef.setCheckedKeys([], false);
			if (optValue.value.length == state.treeArr[0].children.length) {
				treeRef.setCheckedKeys([state.treeArr[0].id], false);
			} else {
				let arr: any[] = [];
				for (const value of optValue.value) {
					for (let vo of state.treeArr[0].children) {
						if (vo.name == value) {
							arr.push((vo as any).id);
						}
					}
				}
				treeRef.setCheckedKeys(arr, false);
			}
		};
		const setQizhongdianInput = (sugItem) => {
			state.isSetqizhongContent = true;
			state.isShowQizhongSug = false;
			if (state.isStartLuxianFocus) {
				if (sugItem.longitude != 0.0) {
					state.startGhLuxian = sugItem;
					//start search
					if (state.endGhLuxian.longitude != 0.0) {
						state.startGhLuxianPoint.lng = sugItem.longitude;
						state.startGhLuxianPoint.lat = sugItem.latitude;
						state.endGhLuxianPoint.lng = state.endGhLuxian.longitude;
						state.endGhLuxianPoint.lat = state.endGhLuxian.latitude;
						var polyline = new BMap.Polyline([state.startGhLuxianPoint, state.endGhLuxianPoint], {
							strokeColor: 'red',
							strokeWeight: 6,
							strokeOpacity: 0.5,
						});
						state.ghLuxianPolyline = polyline;
						state.bmap.addOverlay(polyline);
						/*
			  			state.ghLuxianPolyline=BMap.Polyline([
			  			state.startGhLuxianPoint,state.endGhLuxianPoint],
			  			{strokeColor: "blue", strokeWeight: 6, strokeOpacity: 0.5});
			  			state.bmap.addOverlay(state.ghLuxianPolyline);*/
					}
				}
			} else if (state.isEndLuxianFocus) {
				if (sugItem.longitude != 0.0) {
					state.endGhLuxian = sugItem;
					//start search
					if (state.startGhLuxian.longitude != 0.0) {
						state.startGhLuxianPoint.lng = state.startGhLuxian.longitude;
						state.startGhLuxianPoint.lat = state.startGhLuxian.latitude;
						state.endGhLuxianPoint.lng = sugItem.longitude;
						state.endGhLuxianPoint.lat = sugItem.latitude;
						var polyline = new BMap.Polyline([state.startGhLuxianPoint, state.endGhLuxianPoint], {
							strokeColor: 'red',
							strokeWeight: 6,
							strokeOpacity: 0.5,
						});
						state.ghLuxianPolyline = polyline;
						state.bmap.addOverlay(polyline);
						/*
			  			state.ghLuxianPolyline=BMap.Polyline([
			  			state.startGhLuxianPoint,state.endGhLuxianPoint],
			  			{strokeColor: "blue", strokeWeight: 6, strokeOpacity: 0.5});
			  			state.bmap.addOverlay(state.ghLuxianPolyline);*/
					}
				}
			}
			//start to
		};
		const clickGhLuxian = () => {
			state.showLuxian = !state.showLuxian;
			if (state.showLuxian) {
				state.endGhLuxian.address = '';
				state.startGhLuxian.address = '';
				state.isShowSearchSug = false;
				if (state.showToolsBox) {
					state.showToolsBox = false;
					state.isMarkActive = false;
					state.isShouhuiActive = false;
				}
			} else {
				state.startGhLuxian.address = state.endGhLuxian.address = '';
			}
			//start luxian
		};
		const changeRouteIndex = (event) => {
			state.curRouteIndex = event.currentTarget.getAttribute('data-index');
		};
		//搜索事件
		const searchAddr = () => {
			// if (currentSugItems == null) return;
			// if (state.searchContent.address == currentSugItems.address) {
			// 	if (currentSugItems.longitude != 0.0) {
			// 		state.isSetsearchContent = true;
			// 		state.searchContent = currentSugItems;
			// 		state.curSearchPoint.lng = currentSugItems.longitude;
			// 		state.curSearchPoint.lat = currentSugItems.latitude;
			// 		state.bmap.centerAndZoom(state.curSearchPoint, window['bdmapLevel']);
			// 		// 创建标注
			// 		state.curSearchMarker.point = state.curSearchPoint;
			// 		state.bmap.addOverlay(state.curSearchMarker);
			// 	}
			// }
		};
		const loadTypeName = async () => {
			const loadingInstance1 = ElLoading.service({ lock: true, text: 'Loading', background: 'rgba(0, 0, 0, 0.7)' });
			let point = new BMap.Point(window['gLongitudeVal'], window['gLatitudeVal']);
			if (proxy.$route.query.lng && proxy.$route.query.lat) {
				point.lng = proxy.$route.query.lng;
				point.lat = proxy.$route.query.lat;
			}
			let schemetitleArr: string[] = [];
			let schemeId = proxy.$route.query.schemeId;
			if (schemeId) {
				state.schemeId = schemeId;
				let data: any = await HttpReqApi.getHelpschemeOne({ id: schemeId });
				state.schemeData.titleContent = data.titleContent;
				state.schemeData.creatTime = data.creatTime;
				state.schemeData.id = data.id;
				let joinContent = data.joinContent;
				if (joinContent) {
					let obj = JSON.parse(joinContent);
					schemetitleArr = obj.dianTitleArr;
					state.schemelines = obj.schemelines;
					let pnt = state.schemelines[0].coords[0];
					point.lng = pnt[0];
					point.lat = pnt[1];
				}
			}
			if (!schemeId) state.schemeId = 0;
			state.bmap.centerAndZoom(point, window['bdmapLevel']);
			state.getTblData = {};
			(state.getTblData as any).data = [];
			await AllMap.displaySupport(state, schemetitleArr, state.treeArr[0].children);
			await AllMap.delay(200);
			await AllMap.displayJiJie(state, schemetitleArr, state.treeArr[0].children);
			await AllMap.delay(200);
			await AllMap.displayLuxian(state, schemetitleArr, state.treeArr[0].children);
			await AllMap.delay(200);
			await AllMap.displaySuSanDiYu(state, schemetitleArr, state.treeArr[0].children);
			await AllMap.delay(200);
			await AllMap.displayYinBiDiyu(state, schemetitleArr, state.treeArr[0].children);
			await AllMap.delay(200);
			await AllMap.displayBaoZhangDian(state, schemetitleArr, state.treeArr[0].children);
			await AllMap.delay(200);
			await AllMap.displaWuZiDian(state, schemetitleArr, state.treeArr[0].children);
			await AllMap.delay(200);
			await AllMap.displayZhanyeDian(state, schemetitleArr, state.treeArr[0].children);
			await AllMap.delay(200);
			await AllMap.displayZhihuiDian(state, schemetitleArr, state.treeArr[0].children);
			await AllMap.delay(200);
			await AllMap.displayJinjiDian(state, schemetitleArr, state.treeArr[0].children);
			await AllMap.delay(200);
			AllMap.displaySchemeLines(state);
			loadingInstance1.close();
			for (const vo of state.cities) {
				// if (vo.value == '方案') continue;
				optValueBefore.push(vo.value);
				optValue.value.push(vo.value);
			}
			// optValue.value = ['集结点'];
			// 	onChangeOpt(['集结点']);
			// 	return;
			if (state.pageType && state.pageType.indexOf('队伍') != -1 && state.pageType != '队伍点') {
				let nowPageType = state.pageType + '';
				state.pageType = '队伍点';
				optValue.value = ['队伍点'];
				onChangeOpt(['队伍点']);
				state.singledrawer = true;
				let teamIdArr = [];
				let hideVoArr: any[] = AllMap.displayOneTeam(state, state.treeArr[0].children, state.zhanyeDian, nowPageType, teamIdArr);
				if (teamIdArr.length > 0) (state.expandedArr as any).push(teamIdArr[0]);
				setTimeout(() => {
					let treeRef = proxy.$refs.treeRef;
					for (const vo of hideVoArr) {
						treeRef.setChecked((vo as any).id, false, false);
						AllMap.hideOne(state, vo.name, '队伍点');
					}
					if (hideVoArr.length > 0) AllMap.updateChangeDisplay(state);
				}, 500);
				return;
			}
			if (state.pageType == '方案') {
				optValue.value = ['方案'];
				onChangeOpt(['方案']);
				return;
			}
			if (state.pageType == '集结点') {
				optValue.value = ['集结点'];
				onChangeOpt(['集结点']);
				state.singledrawer = true;
				getGroupOnePnt(state.jijieDian);
				let id = AllMap.getTeamId(state.treeArr[0].children, '集结点');
				(state.expandedArr as any).push(id);
				return;
			}
			if (state.pageType == '疏散路线') {
				optValue.value = ['疏散路线'];
				onChangeOpt(['疏散路线']);
				state.singledrawer = true;
				getGroupOnePnt(state.luxianDian);
				let id = AllMap.getTeamId(state.treeArr[0].children, '疏散路线');
				(state.expandedArr as any).push(id);
				return;
			}
			if (state.pageType == '疏散地域') {
				optValue.value = ['疏散地域'];
				onChangeOpt(['疏散地域']);
				state.singledrawer = true;
				getGroupOnePnt(state.shusandiyuDian);
				let id = AllMap.getTeamId(state.treeArr[0].children, '疏散地域');
				(state.expandedArr as any).push(id);
				return;
			}
			if (state.pageType == '隐蔽地域') {
				optValue.value = ['隐蔽地域'];
				onChangeOpt(['隐蔽地域']);
				state.singledrawer = true;
				getGroupOnePnt(state.yinbidiyuDian);
				let id = AllMap.getTeamId(state.treeArr[0].children, '隐蔽地域');
				(state.expandedArr as any).push(id);
				return;
			}
			if (state.pageType == '防空警报点') {
				optValue.value = ['防空警报点'];
				onChangeOpt(['防空警报点']);
				state.singledrawer = true;
				getGroupOnePnt(state.baozhangDian);
				let id = AllMap.getTeamId(state.treeArr[0].children, '防空警报点');
				(state.expandedArr as any).push(id);
				return;
			}
			if (state.pageType == '保障点') {
				optValue.value = ['保障点'];
				onChangeOpt(['保障点']);
				state.singledrawer = true;
				getGroupOnePnt(state.supportDian);
				let id = AllMap.getTeamId(state.treeArr[0].children, '保障点');
				(state.expandedArr as any).push(id);
				return;
			}
			if (state.pageType == '物资点') {
				optValue.value = ['物资点'];
				onChangeOpt(['物资点']);
				state.singledrawer = true;
				getGroupOnePnt(state.wuziDian);
				let id = AllMap.getTeamId(state.treeArr[0].children, '物资点');
				(state.expandedArr as any).push(id);
				return;
			}
			if (state.pageType == '队伍点') {
				optValue.value = ['队伍点'];
				onChangeOpt(['队伍点']);
				state.singledrawer = true;
				getGroupOnePnt(state.zhanyeDian);
				let id = AllMap.getTeamId(state.treeArr[0].children, '队伍点');
				(state.expandedArr as any).push(id);
				return;
			}
			if (state.pageType == '人防点') {
				optValue.value = ['人防点'];
				onChangeOpt(['人防点']);
				state.singledrawer = true;
				getGroupOnePnt(state.zhihuiDian);
				let id = AllMap.getTeamId(state.treeArr[0].children, '人防点');
				(state.expandedArr as any).push(id);
				return;
			}
			if (state.pageType == '经济目标') {
				optValue.value = ['经济目标'];
				onChangeOpt(['经济目标']);
				state.singledrawer = true;
				getGroupOnePnt(state.jingjiDian);
				let id = AllMap.getTeamId(state.treeArr[0].children, '经济目标');
				(state.expandedArr as any).push(id);
				return;
			}
		};
		const getGroupOnePnt = (arr: any) => {
			for (const data of arr) {
				let lng = data.value[0];
				let lat = data.value[1];
				let point = new BMap.Point(lng, lat);
				(state.bmap as any).centerAndZoom(point, window['bdmapLevel']);
				return;
			}
		};
		const resetTempArticleModel = () => {
			state.tempArticleModel = cloneDeep(defaultArticleModel);
			state.tempArticleModel.importance = state.pageType;
			state.dialogStatus = 'create';
			/*
        	nextTick(() => {
	          (dataForm.value as typeof ElForm).clearValidate();
	        });
	        */
		};
		const editDialogShowByLoc = (offsetx, offsety) => {
			let el = proxy.$refs.elybdymapDialog;
			if (el) {
				let locx, locy;
				if (offsetx > 1120) locx = 1170;
				else locx = offsetx + 50;
				el.style.left = locx + 'px';
				if (offsety > 300) locy = offsety - 300;
				else locy = offsety + 70;
				el.style.top = locy + 'px';
				ElMessage.success(offsetx + ',' + offsety);
				state.dialogFormVisible = true;
			}
		};
		const getShowLoc = (offsetx, offsety) => {
			let locx, locy;
			if (offsetx > 1120) locx = 1170;
			else locx = offsetx + 50;
			if (offsety > 300) locy = offsety - 300;
			else locy = offsety + 70;
			return { x: locx, y: locy };
		};
		const clearNewZhanbei = async () => {
			let delDian = [];
			for (let i = 0; i < state.wuziDian.length; i++) {
				let ele = state.wuziDian[i];
				if (ele.name == '') {
					delDian.push(i);
					break;
				}
			}
			let j = 0;
			delDian.forEach((ele) => {
				state.wuziDian.splice(ele - j, 1);
				j++;
			});
			if (j) {
				AllMap.updateGroups(optValueBefore, state, '物资点');
			}
		};
		const clearNewZhuanye = async () => {
			let delDian = [];
			for (let i = 0; i < state.zhanyeDian.length; i++) {
				let ele = state.zhanyeDian[i];
				if (ele.name == '') {
					delDian.push(i);
					break;
				}
			}
			let j = 0;
			delDian.forEach((ele) => {
				state.zhanyeDian.splice(ele - j, 1);
				j++;
			});
			if (j) {
				AllMap.updateGroups(optValueBefore, state, '队伍点');
			}
		};
		const clearNewZhihui = async () => {
			let delDian = [];
			for (let i = 0; i < state.zhihuiDian.length; i++) {
				let ele = state.zhihuiDian[i];
				if (ele.name == '') {
					delDian.push(i);
					break;
				}
			}
			let j = 0;
			delDian.forEach((ele) => {
				state.zhihuiDian.splice(ele - j, 1);
				j++;
			});
			if (j) {
				AllMap.updateGroups(optValueBefore, state, '人防点');
			}
		};
		const clearNewJIngji = async () => {
			let delDian = [];
			for (let i = 0; i < state.jingjiDian.length; i++) {
				let ele = state.jingjiDian[i];
				if (ele.name == '') {
					delDian.push(i);
					break;
				}
			}
			let j = 0;
			delDian.forEach((ele) => {
				state.jingjiDian.splice(ele - j, 1);
				j++;
			});
			if (j) {
				AllMap.updateGroups(optValueBefore, state, '经济目标');
			}
		};
		const createZhanbei = async (tempArticleModel: any, rowlist: any) => {
			let ret = 0;
			let upt = 0;
			let idx = 0;
			for (let i = 0; i < state.wuziDian.length; i++) {
				let ele = state.wuziDian[i];
				if (ele.name == '') {
					tempArticleModel.sourceURL = ele.value[0];
					tempArticleModel.imageURL = ele.value[1];
					ret++;
					idx = i;
					break;
				}
			}
			if (ret) {
				let fullContent = JSON.stringify(rowlist);
				const articleId = await createArticle({ ...tempArticleModel, fullContent }, ArticleType.ZBWZ);
				// state.dialogFormVisible = false;
				ElMessage.success('添加成功');
				// state.dialogStatus = 'success';
				tempArticleModel.id = articleId;
				let tbldatavo = { ...tempArticleModel, fullContent };
				state.getTblData.data.push(tbldatavo);
				state.wuziDian[idx].name = tempArticleModel.title;
				state.wuziDian[idx].htmlcontentstr = AllMap.getWuziHtmlstr(tbldatavo);
				upt++;
				if (upt) {
					state.myChart.setOption({
						series: [
							{
								// 根据名字对应到相应的系列
								name: '物资点',
								data: state.wuziDian,
							},
						],
					});
				}
			}
			return;
		};
		const createZhihui = async (tempArticleModel: any, rowarr: any, defenseProVo) => {
			let ret = 0;
			let upt = 0;
			let idx = 0;
			for (let i = 0; i < state.zhihuiDian.length; i++) {
				let ele = state.zhihuiDian[i];
				if (ele.name == '') {
					tempArticleModel.sourceURL = ele.value[0];
					tempArticleModel.imageURL = ele.value[1];
					ret++;
					idx = i;
					break;
				}
			}
			if (ret) {
				let fullContent = JSON.stringify(defenseProVo);
				const articleId = await createArticle({ ...tempArticleModel, fullContent }, ArticleType.ZHJG);
				// state.dialogFormVisible = false;
				ElMessage.success('添加成功');
				// state.dialogStatus = 'success';
				tempArticleModel.id = articleId;
				let tbldatavo = { ...tempArticleModel, fullContent };
				state.getTblData.data.push(tbldatavo);
				state.zhihuiDian[idx].name = tempArticleModel.title;
				state.zhihuiDian[idx].htmlcontentstr = AllMap.getZhihuiHtmlstr(tbldatavo);
				upt++;
				if (upt) {
					state.myChart.setOption({
						series: [
							{
								// 根据名字对应到相应的系列
								name: '人防点',
								data: state.zhihuiDian,
							},
						],
					});
				}
			}
			return;
		};
		const createJingji = async (tempArticleModel: any) => {
			let ret = 0;
			let upt = 0;
			let idx = 0;
			for (let i = 0; i < state.jingjiDian.length; i++) {
				let ele = state.jingjiDian[i];
				if (ele.name == '') {
					tempArticleModel.sourceURL = ele.value[0];
					tempArticleModel.imageURL = ele.value[1];
					ret++;
					idx = i;
					break;
				}
			}
			if (ret) {
				tempArticleModel.type = '经济';
				tempArticleModel.importance = '经济目标';
				const articleId = await createArticle({ ...tempArticleModel }, ArticleType.SSYS);
				// state.dialogFormVisible = false;
				ElMessage.success('添加成功');
				// state.dialogStatus = 'success';
				tempArticleModel.id = articleId;
				let tbldatavo = { ...tempArticleModel };
				state.getTblData.data.push(tbldatavo);
				state.jingjiDian[idx].name = tempArticleModel.title;
				state.jingjiDian[idx].htmlcontentstr = AllMap.getJinjiHtmlStr(tbldatavo);
				upt++;
				if (upt) {
					state.myChart.setOption({
						series: [
							{
								// 根据名字对应到相应的系列
								name: '经济目标',
								data: state.jingjiDian,
							},
						],
					});
				}
			}
			return;
		};
		const createZhuanye = async (tempArticleModel: any, rowlist: any) => {
			let ret = 0;
			let upt = 0;
			let idx = 0;
			for (let i = 0; i < state.zhanyeDian.length; i++) {
				let ele = state.zhanyeDian[i];
				if (ele.name == '') {
					tempArticleModel.sourceURL = ele.value[0];
					tempArticleModel.imageURL = ele.value[1];
					ret++;
					idx = i;
					break;
				}
			}
			if (ret) {
				let fullContent = JSON.stringify(rowlist);
				const articleId = await createArticle({ ...tempArticleModel, fullContent }, ArticleType.ZYDW);
				// state.dialogFormVisible = false;
				ElMessage.success('添加成功');
				// state.dialogStatus = 'success';
				tempArticleModel.id = articleId;
				let tbldatavo = { ...tempArticleModel, fullContent };
				state.getTblData.data.push(tbldatavo);
				state.zhanyeDian[idx].name = tempArticleModel.title;
				state.zhanyeDian[idx].htmlcontentstr = AllMap.getDuiwuHtmlstr(tbldatavo);
				upt++;
				if (upt) {
					state.myChart.setOption({
						series: [
							{
								// 根据名字对应到相应的系列
								name: '队伍点',
								data: state.zhanyeDian,
							},
						],
					});
				}
			}
			return;
		};
		const createData = async () => {
			//const form = unref(dataForm);
			let ArticleModel = state.tempArticleModel;
			let ret = 0;
			let upt = 0;
			let idx = 0;
			if (ArticleModel.title.length > 0 && ArticleModel.status.length > 0) {
				if (toolOptValue.value.substring(1) == '集结点') {
					ret = 0;
					upt = 0;
					idx = 0;
					for (let i = 0; i < state.jijieDian.length; i++) {
						let ele = state.jijieDian[i];
						if (ele.name == '') {
							ArticleModel.sourceURL = ele.value[0];
							ArticleModel.imageURL = ele.value[1];
							ret++;
							idx = i;
							break;
						}
					}
					if (ret) {
						ArticleModel.importance = '集结点';
						ArticleModel.type = '集结';
						let articleId = await createArticle({ ...ArticleModel, platforms: upt }, ArticleType.SSYS);
						state.dialogFormVisible = false;
						ElMessage.success('添加成功');
						state.dialogStatus = 'success';
						ArticleModel.id = articleId;
						state.getTblData.data.push(cloneDeep(ArticleModel));
						state.jijieDian[idx].name = ArticleModel.title;
						state.jijieDian[idx].htmlcontentstr = AllMap.getSuSanHtmlStr(ArticleModel);
						upt++;
						if (upt) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '集结点',
										data: state.jijieDian,
									},
								],
							});
						}
					}
					return;
				}
				if (toolOptValue.value.substring(1) == '防空警报点') {
					ret = 0;
					upt = 0;
					idx = 0;
					for (let i = 0; i < state.baozhangDian.length; i++) {
						let ele = state.baozhangDian[i];
						if (ele.name == '') {
							ArticleModel.sourceURL = ele.value[0];
							ArticleModel.imageURL = ele.value[1];
							ret++;
							idx = i;
							break;
						}
					}
					if (ret) {
						ArticleModel.importance = '防空警报点';
						ArticleModel.type = '警报';
						if(ArticleModel.jingbaoqiType === '多媒体'){
							ArticleModel.pageviews = '（多媒体警报器）'
						}else if(ArticleModel.jingbaoqiType === '电声一体'){
							ArticleModel.pageviews = '（老旧新建一体机警报器）'
						}else{
							ArticleModel.pageviews = '电声警报器'
						}
						let articleId = await createArticle({ ...ArticleModel, platforms: upt }, ArticleType.SSYS);
						state.dialogFormVisible = false;
						ElMessage.success('添加成功');
						state.dialogStatus = 'success';
						ArticleModel.id = articleId;
						state.getTblData.data.push(cloneDeep(ArticleModel));
						state.baozhangDian[idx].name = ArticleModel.title;
						state.baozhangDian[idx].htmlcontentstr = AllMap.getSuSanHtmlStr(ArticleModel);
						upt++;
						if (upt) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '防空警报点',
										data: state.baozhangDian,
									},
								],
							});
						}
					}
					return;
				}
				if (toolOptValue.value.substring(1) == '保障点') {
					ret = 0;
					upt = 0;
					idx = 0;
					for (let i = 0; i < state.supportDian.length; i++) {
						let ele = state.supportDian[i];
						if (ele.name == '') {
							ArticleModel.sourceURL = ele.value[0];
							ArticleModel.imageURL = ele.value[1];
							ret++;
							idx = i;
							break;
						}
					}
					if (ret) {
						ArticleModel.importance = '保障点';
						ArticleModel.type = '保障';
						let articleId = await createArticle({ ...ArticleModel, platforms: upt }, ArticleType.SSYS);
						state.dialogFormVisible = false;
						ElMessage.success('添加成功');
						state.dialogStatus = 'success';
						ArticleModel.id = articleId;
						state.getTblData.data.push(cloneDeep(ArticleModel));
						state.supportDian[idx].name = ArticleModel.title;
						state.supportDian[idx].htmlcontentstr = AllMap.getSuSanHtmlStr(ArticleModel);
						upt++;
						if (upt) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '保障点',
										data: state.supportDian,
									},
								],
							});
						}
					}
					return;
				}
				if (toolOptValue.value.substring(1) == '疏散路线') {
					ret = 0;
					upt = 0;
					idx = 0;
					let createCount = 0;
					let newLuxianDianArr: any[] = [];
					for (let i = 0; i < state.luxianDian.length; i++) {
						let ele = state.luxianDian[i];
						if (ele.name == dftSeriesLinesData.name) {
							ArticleModel.sourceURL = ele.value[0];
							ArticleModel.imageURL = ele.value[1];
							ArticleModel.importance = '疏散路线';
							ArticleModel.type = '疏散';
							let articleId = await createArticle({ ...ArticleModel, platforms: upt }, ArticleType.SSYS, createCount == 0 ? true : false);
							state.dialogStatus = 'success';
							state.luxianDian[i].name = ArticleModel.title;
							newLuxianDianArr.push(state.luxianDian[i]);
							ArticleModel.id = articleId;
							upt++;
							createCount++;
							state.getTblData.data.push(cloneDeep(ArticleModel));
						}
					}
					let htmlcontentstr = AllMap.getSuSanHtmlStr(ArticleModel);
					for (let index = 0; index < newLuxianDianArr.length; index++) {
						let dian: any = newLuxianDianArr[index];
						if (index == 0 || index == newLuxianDianArr.length - 1) {
							dian.label = { show: index == 0 };
							dian.symbol = AllMap.getImaByStatus('疏散路线', '疏散路线', index);
							dian.symbolSize = [51 / 2, 76 / 2];
							dian.status = '疏散路线';
							dian.luIndex = index + 1;
							dian.htmlcontentstr = htmlcontentstr;
							continue;
						}
						dian.label = { show: index == 0 };
						dian.status = '疏散路线';
					}
					state.dialogFormVisible = false;
					if (upt) {
						ElMessage.success('添加成功');
						state.myChart.setOption({
							series: [
								{
									// 根据名字对应到相应的系列
									name: '路线点',
									data: state.luxianDian,
								},
							],
						});
						ret = 0;
						for (let i = 0; i < state.shusanLuxianData.length; i++) {
							let ele = state.shusanLuxianData[i];
							if (ele.name == dftSeriesLinesData.name) {
								state.shusanLuxianData[i].name = ArticleModel.title;
								ret++;
								break;
							}
						}
						if (ret) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '疏散路线',
										data: state.shusanLuxianData,
									},
								],
							});
						}
					} else ElMessage.warning('添加错误');
					return;
				}
				if (toolOptValue.value.substring(1) == '疏散地域') {
					ret = 0;
					upt = 0;
					idx = 0;
					let createCount = 0;
					for (let i = 0; i < state.shusanDiyuData.length; i++) {
						let ele = state.shusanDiyuData[i];
						if (ele.name == dftSeriesLinesData.name) {
							//ele.coords
							for (let j = 0; j < 4; j += 2) {
								let parr = ele.coords[j];
								ArticleModel.sourceURL = parr[0];
								ArticleModel.imageURL = parr[1];
								ArticleModel.importance = '疏散地域';
								ArticleModel.type = '疏散';
								let articleId = await createArticle({ ...ArticleModel, platforms: upt }, ArticleType.SSYS, createCount == 0 ? true : false);
								state.dialogStatus = 'success';
								state.shusanDiyuData[i].name = ArticleModel.title;
								ArticleModel.id = articleId;
								state.getTblData.data.push(cloneDeep(ArticleModel));
								upt++;
								createCount++;
							}
							break;
						}
					}
					state.dialogFormVisible = false;
					if (upt) {
						ElMessage.success('添加成功');
						state.myChart.setOption({
							series: [
								{
									// 根据名字对应到相应的系列
									name: '疏散地域',
									data: state.shusanDiyuData,
								},
							],
						});
						ret = 0;
						for (let i = 0; i < state.shusandiyuDian.length; i++) {
							let ele = state.shusandiyuDian[i];
							if (ele.name == dftSeriesLinesData.name) {
								state.shusandiyuDian[i].name = ArticleModel.title;
								state.shusandiyuDian[i].htmlcontentstr = AllMap.getSuSanHtmlStr(ArticleModel);
								(state.shusandiyuDian[i].symbol = AllMap.getImaByStatus('疏散地域', '疏散地域')), (state.shusandiyuDian[i].status = '疏散地域');
								ret++;
								break;
							}
						}
						if (ret) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '疏散地域点',
										data: state.shusandiyuDian,
									},
								],
							});
						}
					} else ElMessage.warning('添加错误');
					beforeToolOptValue.value = '';
					toolOptValue.value = '';
					return;
				}
				if (toolOptValue.value.substring(1) == '隐蔽地域') {
					ret = 0;
					upt = 0;
					idx = 0;
					let createCount = 0;
					for (let i = 0; i < state.yinbiDiyuData.length; i++) {
						let ele = state.yinbiDiyuData[i];
						if (ele.name == dftSeriesLinesData.name) {
							//ele.coords
							for (let j = 0; j < 4; j += 2) {
								let parr = ele.coords[j];
								ArticleModel.sourceURL = parr[0];
								ArticleModel.imageURL = parr[1];
								ArticleModel.importance = '隐蔽地域';
								ArticleModel.type = '隐蔽';
								let articleId = await createArticle({ ...ArticleModel, platforms: upt }, ArticleType.SSYS, createCount == 0 ? true : false);
								state.dialogStatus = 'success';
								state.yinbiDiyuData[i].name = ArticleModel.title;
								ArticleModel.id = articleId;
								state.getTblData.data.push(cloneDeep(ArticleModel));
								upt++;
								createCount++;
							}
							break;
						}
					}
					state.dialogFormVisible = false;
					if (upt) {
						ElMessage.success('添加成功');
						state.myChart.setOption({
							series: [
								{
									// 根据名字对应到相应的系列
									name: '隐蔽地域',
									data: state.yinbiDiyuData,
								},
							],
						});
						ret = 0;
						for (let i = 0; i < state.yinbidiyuDian.length; i++) {
							let ele = state.yinbidiyuDian[i];
							if (ele.name == dftSeriesLinesData.name) {
								state.yinbidiyuDian[i].name = ArticleModel.title;
								state.yinbidiyuDian[i].htmlcontentstr = AllMap.getSuSanHtmlStr(ArticleModel);
								(state.yinbidiyuDian[i].symbol = AllMap.getImaByStatus('隐蔽地域', '隐蔽地域')), (state.yinbidiyuDian[i].status = '隐蔽地域');
								ret++;
								break;
							}
						}
						if (ret) {
							state.myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '隐蔽地域点',
										data: state.yinbidiyuDian,
									},
								],
							});
						}
					} else ElMessage.warning('添加错误');
					beforeToolOptValue.value = '';
					toolOptValue.value = '';
					return;
				}
				return;
			}
			ElMessage.error('请填写必填参数');
		};
		const compObject = (a, b) => {
			//取对象a和b的属性名
			let aProps = Object.getOwnPropertyNames(a);
			let bProps = Object.getOwnPropertyNames(b);
			//判断属性名的length是否一致
			if (aProps.length != bProps.length) {
				return false;
			}
			//循环取出属性名，再判断属性值是否一致
			for (let i = 0; i < aProps.length; i++) {
				let propName = aProps[i];
				if (a[propName] !== b[propName]) {
					return false;
				}
			}
			return true;
		};
		const delZhanbei = async (tempArticleModel) => {
			await deleteArticle(tempArticleModel.id, ArticleType.ZBWZ)
				.then(() => {
					ElMessage.success({
						message: '删除成功',
						type: 'success',
						duration: 2000,
					});
					let i = 0;
					for (i = 0; i < state.wuziDian.length; i++) {
						let ele = state.wuziDian[i];
						if (ele.name == tempArticleModel.title) {
							break;
						}
					}
					let tblIndex = 0;
					for (const tblvo of state.getTblData.data) {
						if (tblvo.title == tempArticleModel.title) {
							state.getTblData.data.splice(tblIndex, 1);
							break;
						}
						tblIndex++;
					}
					if (i != state.wuziDian.length) {
						state.wuziDian.splice(i, 1);
						AllMap.updateGroups(optValueBefore, state, '物资点');
					}
				})
				.catch((err) => {
					ElMessage.warning('删除失败');
				});
		};
		const delZhuanye = async (tempArticleModel) => {
			await deleteArticle(tempArticleModel.id, ArticleType.ZYDW)
				.then(() => {
					ElMessage.success({
						message: '删除成功',
						type: 'success',
						duration: 2000,
					});
					let i = 0;
					for (i = 0; i < state.zhanyeDian.length; i++) {
						let ele = state.zhanyeDian[i];
						if (ele.name == tempArticleModel.title) {
							break;
						}
					}
					let tblIndex = 0;
					for (const tblvo of state.getTblData.data) {
						if (tblvo.title == tempArticleModel.title) {
							state.getTblData.data.splice(tblIndex, 1);
							break;
						}
						tblIndex++;
					}
					if (i != state.zhanyeDian.length) {
						state.zhanyeDian.splice(i, 1);
						AllMap.updateGroups(optValueBefore, state, '队伍点');
					}
				})
				.catch((err) => {
					ElMessage.warning('删除失败');
				});
		};
		const delZhihui = async (tempArticleModel) => {
			await deleteArticle(tempArticleModel.id, ArticleType.ZHJG)
				.then(() => {
					ElMessage.success({
						message: '删除成功',
						type: 'success',
						duration: 2000,
					});
					let i = 0;
					for (i = 0; i < state.zhihuiDian.length; i++) {
						let ele = state.zhihuiDian[i];
						if (ele.name == tempArticleModel.title) {
							break;
						}
					}
					let tblIndex = 0;
					for (const tblvo of state.getTblData.data) {
						if (tblvo.title == tempArticleModel.title) {
							state.getTblData.data.splice(tblIndex, 1);
							break;
						}
						tblIndex++;
					}
					if (i != state.zhihuiDian.length) {
						state.zhihuiDian.splice(i, 1);
						AllMap.updateGroups(optValueBefore, state, '人防点');
					}
				})
				.catch((err) => {
					ElMessage.warning('删除失败');
				});
		};
		const delJingji = async (tempArticleModel) => {
			await deleteArticle(tempArticleModel.id, ArticleType.SSYS)
				.then(() => {
					ElMessage.success({
						message: '删除成功',
						type: 'success',
						duration: 2000,
					});
					let i = 0;
					for (i = 0; i < state.jingjiDian.length; i++) {
						let ele = state.jingjiDian[i];
						if (ele.name == tempArticleModel.title) {
							break;
						}
					}
					let tblIndex = 0;
					for (const tblvo of state.getTblData.data) {
						if (tblvo.title == tempArticleModel.title) {
							state.getTblData.data.splice(tblIndex, 1);
							break;
						}
						tblIndex++;
					}
					if (i != state.jingjiDian.length) {
						state.jingjiDian.splice(i, 1);
						AllMap.updateGroups(optValueBefore, state, '经济目标');
					}
				})
				.catch((err) => {
					ElMessage.warning('删除失败');
				});
		};
		const updateZhanbei = async (tempArticleModel, rowlist) => {
			let e = state.uptDelContext;
			let fullContent = JSON.stringify(rowlist);
			const data = await updateArticle({ ...tempArticleModel, fullContent, sourceURL: null, imageURL: null }, ArticleType.ZBWZ)
				.then(async () => {
					ElMessage.success('更新成功');
					for (let i = 0; i < state.getTblData.data.length; i++) {
						let ele = state.getTblData.data[i];
						if (ele.title == e.name) {
							tempArticleModel.sourceURL = '';
							tempArticleModel.imageURL = '';
							let sourceURL = state.getTblData.data[i].sourceURL;
							let imageURL = state.getTblData.data[i].imageURL;
							state.getTblData.data[i] = deepClone(tempArticleModel);
							state.getTblData.data[i].sourceURL = sourceURL;
							state.getTblData.data[i].imageURL = imageURL;
							state.getTblData.data[i].fullContent = fullContent;
							state.zhanbeiVisible = false;
							let ret = false;
							for (let j = 0; j < state.wuziDian.length; j++) {
								let ele = state.wuziDian[j];
								if (ele.name == e.name) {
									ele.name = tempArticleModel.title;
									ele.htmlcontentstr = AllMap.getWuziHtmlstr(state.getTblData.data[i]);
									ret = true;
									break;
								}
							}
							if (ret) {
								AllMap.updateGroups(optValueBefore, state, '物资点');
							}
							break;
						}
					}
				})
				.catch((err) => {
					ElMessage.warning('更新失败');
				});
		};
		const updateZhuanye = async (tempArticleModel, rowlist) => {
			let e = state.uptDelContext;
			let fullContent = JSON.stringify(rowlist);
			const data = await updateArticle({ ...tempArticleModel, fullContent, sourceURL: null, imageURL: null }, ArticleType.ZYDW)
				.then(async () => {
					ElMessage.success('更新成功');
					for (let i = 0; i < state.getTblData.data.length; i++) {
						let ele = state.getTblData.data[i];
						if (ele.title == e.name) {
							tempArticleModel.sourceURL = '';
							tempArticleModel.imageURL = '';
							let sourceURL = state.getTblData.data[i].sourceURL;
							let imageURL = state.getTblData.data[i].imageURL;
							state.getTblData.data[i] = deepClone(tempArticleModel);
							state.getTblData.data[i].sourceURL = sourceURL;
							state.getTblData.data[i].imageURL = imageURL;
							state.getTblData.data[i].fullContent = fullContent;
							state.zhuanyeVisible = false;
							let ret = false;
							for (let j = 0; j < state.zhanyeDian.length; j++) {
								let ele = state.zhanyeDian[j];
								if (ele.name == e.name) {
									ele.name = tempArticleModel.title;
									ele.htmlcontentstr = AllMap.getDuiwuHtmlstr(state.getTblData.data[i]);
									ret = true;
									break;
								}
							}
							if (ret) {
								AllMap.updateGroups(optValueBefore, state, '队伍点');
							}
							break;
						}
					}
				})
				.catch((err) => {
					ElMessage.warning('更新失败');
				});
		};
		const updateZhihui = async (tempArticleModel, rowArr, defenseProVo) => {
			let e = state.uptDelContext;
			let fullContent = JSON.stringify(defenseProVo);
			const data = await updateArticle({ ...tempArticleModel, fullContent, sourceURL: null, imageURL: null }, ArticleType.ZHJG)
				.then(async () => {
					ElMessage.success('更新成功');
					for (let i = 0; i < state.getTblData.data.length; i++) {
						let ele = state.getTblData.data[i];
						if (ele.title == e.name) {
							tempArticleModel.sourceURL = '';
							tempArticleModel.imageURL = '';
							let sourceURL = state.getTblData.data[i].sourceURL;
							let imageURL = state.getTblData.data[i].imageURL;
							state.getTblData.data[i] = deepClone(tempArticleModel);
							state.getTblData.data[i].sourceURL = sourceURL;
							state.getTblData.data[i].imageURL = imageURL;
							state.getTblData.data[i].fullContent = fullContent;
							state.zhihuiVisible = false;
							let ret = false;
							for (let j = 0; j < state.zhihuiDian.length; j++) {
								let ele = state.zhihuiDian[j];
								if (ele.name == e.name) {
									ele.name = tempArticleModel.title;
									ele.htmlcontentstr = AllMap.getZhihuiHtmlstr(state.getTblData.data[i]);
									ret = true;
									break;
								}
							}
							if (ret) {
								AllMap.updateGroups(optValueBefore, state, '人防点');
							}
							break;
						}
					}
				})
				.catch((err) => {
					ElMessage.warning('更新失败');
				});
		};
		const updateJingji = async (tempArticleModel) => {
			let e = state.uptDelContext;
			tempArticleModel.importance = '经济目标';
			tempArticleModel.type = '经济';
			const data = await updateArticle({ ...tempArticleModel, sourceURL: null, imageURL: null }, ArticleType.SSYS)
				.then(async () => {
					ElMessage.success('更新成功');
					for (let i = 0; i < state.getTblData.data.length; i++) {
						let ele = state.getTblData.data[i];
						if (ele.title == e.name) {
							tempArticleModel.sourceURL = '';
							tempArticleModel.imageURL = '';
							let sourceURL = state.getTblData.data[i].sourceURL;
							let imageURL = state.getTblData.data[i].imageURL;
							state.getTblData.data[i] = deepClone(tempArticleModel);
							state.getTblData.data[i].sourceURL = sourceURL;
							state.getTblData.data[i].imageURL = imageURL;
							state.jingjiVisible = false;
							let ret = false;
							for (let j = 0; j < state.jingjiDian.length; j++) {
								let ele = state.jingjiDian[j];
								if (ele.name == e.name) {
									ele.name = tempArticleModel.title;
									ele.htmlcontentstr = AllMap.getJinjiHtmlStr(tempArticleModel);
									ret = true;
									break;
								}
							}
							if (ret) {
								AllMap.updateGroups(optValueBefore, state, '经济目标');
							}
							break;
						}
					}
				})
				.catch((err) => {
					ElMessage.warning('更新失败');
				});
		};
		const updateData = async () => {
			let e = state.uptDelContext;
			let idxArr = [];
			let equal = false;
			let oncecomp = false;
			let uptecharts = false;
			let i = 0;
			let ret = true;
			for (i = 0; i < state.getTblData.data.length; i++) {
				let ele = state.getTblData.data[i];
				if (ele.title == e.name) {
					state.tempArticleModel.id = ele.id;
					if (!oncecomp) {
						oncecomp = true;
						equal = compObject(state.tempArticleModel, ele);
					}
					if (!equal) {
						state.tempArticleModel.sourceURL = '';
						state.tempArticleModel.imageURL = '';
						if(state.tempArticleModel.jingbaoqiType === '多媒体'){
							state.tempArticleModel.pageviews = '（多媒体警报器）'
						}else if(state.tempArticleModel.jingbaoqiType === '电声一体'){
							state.tempArticleModel.pageviews = '（老旧新建一体机警报器）'
						}else{
							state.tempArticleModel.pageviews = '电声警报器'
						}						
						console.log(state.tempArticleModel);

						let res = await updateArticle({ ...state.tempArticleModel, sourceURL: null, imageURL: null }, ArticleType.SSYS);
						if (res) {
							Assert.isFalse(true, res + '');
						}
						uptecharts = true;
						let sourceURL = state.getTblData.data[i].sourceURL;
						let imageURL = state.getTblData.data[i].imageURL;
						state.getTblData.data[i] = deepClone(state.tempArticleModel);
						state.getTblData.data[i].sourceURL = sourceURL;
						state.getTblData.data[i].imageURL = imageURL;
					}
				}
			}
			state.dialogFormVisible = false;
			state.jingbaoqiUpdate = false;
			if (!ret) {
				ElMessage.warning('更新失败');
				return;
			}
			ElMessage.success('更新成功');
			if (!uptecharts) return;
			switch (e.seriesName) {
				case '集结点':
					{
						ret = false;
						for (let i = 0; i < state.jijieDian.length; i++) {
							let ele = state.jijieDian[i];
							if (ele.name == e.name) {
								ele.name = state.tempArticleModel.title;
								ele.htmlcontentstr = AllMap.getSuSanHtmlStr(state.tempArticleModel);
								ret = true;
								break;
							}
						}
						if (ret) {
							AllMap.updateGroups(optValueBefore, state, e.seriesName);
						}
					}
					break;
				case '防空警报点':
					{
						ret = false;
						for (let i = 0; i < state.baozhangDian.length; i++) {
							let ele = state.baozhangDian[i];
							if (ele.name == e.name) {
								ele.name = state.tempArticleModel.title;
								ele.htmlcontentstr = AllMap.getSuSanHtmlStr(state.tempArticleModel);
								ret = true;
								break;
							}
						}
						if (ret) {
							AllMap.updateGroups(optValueBefore, state, e.seriesName);
						}
					}
					break;
				case '保障点':
					{
						ret = false;
						for (let i = 0; i < state.supportDian.length; i++) {
							let ele = state.supportDian[i];
							if (ele.name == e.name) {
								ele.name = state.tempArticleModel.title;
								ele.htmlcontentstr = AllMap.getSuSanHtmlStr(state.tempArticleModel);
								ret = true;
								break;
							}
						}
						if (ret) {
							AllMap.updateGroups(optValueBefore, state, e.seriesName);
						}
					}
					break;
				case '路线点':
				case '疏散路线':
					{
						//路线点
						ret = false;
						for (let i = 0; i < state.luxianDian.length; i++) {
							let ele = state.luxianDian[i];
							if (ele.name == e.name) {
								ele.name = state.tempArticleModel.title;
								ele.htmlcontentstr = AllMap.getSuSanHtmlStr(state.tempArticleModel);
								ret = true;
							}
						}
						if (ret) {
							AllMap.updateGroups(optValueBefore, state, '路线点');
						}
						//路线
						ret = false;
						for (let i = 0; i < state.shusanLuxianData.length; i++) {
							let ele = state.shusanLuxianData[i];
							if (ele.name == e.name) {
								ele.name = state.tempArticleModel.title;
								ret = true;
							}
						}
						if (ret) {
							AllMap.updateGroups(optValueBefore, state, '疏散路线');
						}
					}
					break;
				case '疏散地域点':
				case '疏散地域':
					{
						//路线点
						ret = false;
						for (let i = 0; i < state.shusandiyuDian.length; i++) {
							let ele = state.shusandiyuDian[i];
							if (ele.name == e.name) {
								ele.name = state.tempArticleModel.title;
								ele.htmlcontentstr = AllMap.getSuSanHtmlStr(state.tempArticleModel);
								ret = true;
							}
						}
						if (ret) {
							AllMap.updateGroups(optValueBefore, state, '疏散地域点');
						}
						//路线
						ret = false;
						for (let i = 0; i < state.shusanDiyuData.length; i++) {
							let ele = state.shusanDiyuData[i];
							if (ele.name == e.name) {
								ele.name = state.tempArticleModel.title;
								ret = true;
							}
						}
						if (ret) {
							AllMap.updateGroups(optValueBefore, state, '疏散地域');
						}
					}
					break;
				case '隐蔽地域点':
				case '隐蔽地域':
					{
						//路线点
						ret = false;
						for (let i = 0; i < state.yinbidiyuDian.length; i++) {
							let ele = state.yinbidiyuDian[i];
							if (ele.name == e.name) {
								ele.name = state.tempArticleModel.title;
								ele.htmlcontentstr = AllMap.getSuSanHtmlStr(state.tempArticleModel);
								ret = true;
							}
						}
						if (ret) {
							AllMap.updateGroups(optValueBefore, state, '隐蔽地域点');
						}
						//路线
						ret = false;
						for (let i = 0; i < state.yinbiDiyuData.length; i++) {
							let ele = state.yinbiDiyuData[i];
							if (ele.name == e.name) {
								ele.name = state.tempArticleModel.title;
								ret = true;
							}
						}
						if (ret) {
							AllMap.updateGroups(optValueBefore, state, '隐蔽地域');
						}
					}
					break;
			}
		};
		const onChangeOpt = async (optArr: any[]) => {
			let currentTool = toolOptValue.value.substring(1);
			if (optValueBefore.indexOf(currentTool) != -1 && optArr.indexOf(currentTool) == -1) {
				onChangeToolOpt('');
			}
			optValueBefore.splice(0, optValueBefore.length);
			optValueBefore.push(...optArr);
			await AllMap.updateGroups(optValueBefore, state);
			// optValueBefore = [...optArr];
		};
		const onChangeToolOpt = async (opt) => {
			if (opt == '加方案') state.isSave = true;
			if (opt != '加方案') state.isSave = false;
			if (beforeToolOptValue.value) {
				state.showToolsBox = false;
				state.isMarkActive = false;
				state.isShouhuiActive = false;
				state.currentLxDian = [];
				clearTmpDian(beforeToolOptValue.value.substring(1));
			}
			beforeToolOptValue.value = opt;
			toolOptValue.value = opt;
			if (!opt) return;
			state.showToolsBox = true;
			let status = opt.substring(1);
			addTool(status);
			if (optValueBefore.indexOf(status) == -1) {
				optValueBefore.push(status);
				optValue.value.push(status);
				AllMap.updateGroups(optValueBefore, state);
			}
			if (state.singledrawer) {
				treeUpdate();
			}
		};
		const addTool = (status) => {
			if (status == '方案') return;
			if (
				status != '集结点' &&
				status != '防空警报点' &&
				status != '保障点' &&
				status != '物资点' &&
				status != '队伍点' &&
				status != '人防点' &&
				status != '经济目标'
			) {
				state.showToolsBox = false;
				//鼠标样式，想结束则右击，start 手绘
				state.isShouhuiActive = true;
				state.isMarkActive = false;
				// state.bmap.disableDoubleClickZoom();
				return;
			}
			state.isMarkActive = !state.isMarkActive;
			//鼠标样式，start 标记，标记一次，active=false，需要重新点击标记
			if (state.isMarkActive) {
				if (state.isShouhuiActive) {
					state.isShouhuiActive = false;
					// state.bmap.enableDoubleClickZoom();
				}
			}
		};
		const onRightMenu = async (data) => {
			if (data.status.indexOf('|') == -1 && data.contextMenuClickId == 1) {
				let name = data.name;
				AllMap.addToScheme(data.status, name, state);
				return;
			}
			if (data.status.indexOf('|') != -1 && data.contextMenuClickId == 0) {
				if (data.seriesName.indexOf('调度') != -1) {
					AllMap.deleteSchemeline(data.name, state);
					return;
				}
				let name = data.name;
				AllMap.delToScheme(data.status, name, state);
				AllMap.updateGroups(optValueBefore, state);
				return;
			}
			if (data.contextMenuClickId == 3) {
				let moveArr = ['保障点', '集结点', '经济目标', '防空警报点', '物资点', '人防点', '队伍点'];
				if (moveArr.indexOf(data.seriesName) == -1)
					return ElMessage({
						message: '非地图点元素，无法修改位置',
						type: 'error',
					});
				ElMessage('已选中，右击地图移动位置');
				movePnt.name = data.name;
				movePnt.seriesName = data.seriesName;
				return;
			}
			if (data.contextMenuClickId == 4) {
				movePnt.name = '';
				movePnt.seriesName = '';
				ElMessage('退出移动位置成功');
				return;
			}
			for (const vo of state.treeArr[0].children) {
				if (vo.name == data.seriesName) {
					for (const child of vo.children) {
						if ((child as any).name == data.name) {
							let treeRef = proxy.$refs.treeRef;
							treeRef.setChecked((child as any).id, false, false);
							AllMap.hideOne(state, data.name, data.seriesName);
							AllMap.updateChangeDisplay(state);
							break;
						}
					}
					break;
				}
			}
		};
		const handleDelete = async () => {
			if (state.dialogStatus == 'create') {
				state.dialogFormVisible = false;
			} else {
				let e = state.uptDelContext;
				let ret = false;
				await deleteArticleByName(e.name, ArticleType.SSYS)
					.then(() => {
						ElMessage.success({
							message: '删除成功',
							type: 'success',
							duration: 2000,
						});
						ret = true;
					})
					.catch((err) => {
						ElMessage.warning('删除失败');
					});
				state.dialogFormVisible = false;
				if (!ret) return;
				for (let index = state.getTblData.data.length - 1; index >= 0; index--) {
					let tblvo = state.getTblData.data[index];
					if (tblvo.title == e.name) {
						state.getTblData.data.splice(index, 1);
					}
				}
				let i;
				let delDian = [];
				switch (e.seriesName) {
					case '集结点':
						{
							for (i = 0; i < state.jijieDian.length; i++) {
								let ele = state.jijieDian[i];
								if (ele.name == e.name) {
									break;
								}
							}
							if (i != state.jijieDian.length) {
								state.jijieDian.splice(i, 1);
								AllMap.updateGroups(optValueBefore, state, e.seriesName);
							}
						}
						break;
					case '防空警报点':
						{
							for (i = 0; i < state.baozhangDian.length; i++) {
								let ele = state.baozhangDian[i];
								if (ele.name == e.name) {
									break;
								}
							}
							if (i != state.baozhangDian.length) {
								state.baozhangDian.splice(i, 1);
								AllMap.updateGroups(optValueBefore, state, e.seriesName);
							}
						}
						break;
					case '保障点':
						{
							for (i = 0; i < state.supportDian.length; i++) {
								let ele = state.supportDian[i];
								if (ele.name == e.name) {
									break;
								}
							}
							if (i != state.supportDian.length) {
								state.supportDian.splice(i, 1);
								AllMap.updateGroups(optValueBefore, state, e.seriesName);
							}
						}
						break;
					case '路线点':
					case '疏散路线':
						{
							//路线点
							delDian = [];
							for (i = 0; i < state.luxianDian.length; i++) {
								let ele = state.luxianDian[i];
								if (ele.name == e.name) {
									delDian.push(i);
								}
							}
							let j = 0;
							delDian.forEach((ele) => {
								state.luxianDian.splice(ele - j, 1);
								j++;
							});
							if (j) {
								AllMap.updateGroups(optValueBefore, state, '路线点');
							}
							//路线
							delDian = [];
							for (i = 0; i < state.shusanLuxianData.length; i++) {
								let ele = state.shusanLuxianData[i];
								if (ele.name == e.name) {
									delDian.push(i);
									break;
								}
							}
							let k = 0;
							delDian.forEach((ele) => {
								state.shusanLuxianData.splice(ele - k, 1);
								k++;
							});
							if (k) {
								AllMap.updateGroups(optValueBefore, state, '疏散路线');
							}
						}
						break;
					case '疏散地域点':
					case '疏散地域':
						{
							//地域点
							delDian = [];
							for (i = 0; i < state.shusandiyuDian.length; i++) {
								let ele = state.shusandiyuDian[i];
								if (ele.name == e.name) {
									delDian.push(i);
								}
							}
							let j = 0;
							delDian.forEach((ele) => {
								state.shusandiyuDian.splice(ele - j, 1);
								j++;
							});
							if (j) {
								-AllMap.updateGroups(optValueBefore, state, '疏散地域点');
							}
							//地域
							delDian = [];
							for (i = 0; i < state.shusanDiyuData.length; i++) {
								let ele = state.shusanDiyuData[i];
								if (ele.name == e.name) {
									delDian.push(i);
									break;
								}
							}
							let k = 0;
							delDian.forEach((ele) => {
								state.shusanDiyuData.splice(ele - k, 1);
								k++;
							});
							if (k) {
								AllMap.updateGroups(optValueBefore, state, '疏散地域');
							}
						}
						break;
					case '隐蔽地域点':
					case '隐蔽地域':
						{
							//地域点
							delDian = [];
							for (i = 0; i < state.yinbidiyuDian.length; i++) {
								let ele = state.yinbidiyuDian[i];
								if (ele.name == e.name) {
									delDian.push(i);
								}
							}
							let j = 0;
							delDian.forEach((ele) => {
								state.yinbidiyuDian.splice(ele - j, 1);
								j++;
							});
							if (j) {
								AllMap.updateGroups(optValueBefore, state, '隐蔽地域点');
							}
							//地域
							delDian = [];
							for (i = 0; i < state.yinbiDiyuData.length; i++) {
								let ele = state.yinbiDiyuData[i];
								if (ele.name == e.name) {
									delDian.push(i);
									break;
								}
							}
							let k = 0;
							delDian.forEach((ele) => {
								state.yinbiDiyuData.splice(ele - k, 1);
								k++;
							});
							if (k) {
								AllMap.updateGroups(optValueBefore, state, '隐蔽地域');
							}
						}
						break;
				}
			}
		};
		// 设置主内容的高度
		const initTagViewHeight = computed(() => {
			let { isTagsview } = store.state.themeConfig.themeConfig;
			let { isTagsViewCurrenFull } = store.state.tagsViewRoutes;
			if (isTagsViewCurrenFull) {
				return `30px`;
			} else {
				if (isTagsview) return `114px`;
				else return `80px`;
			}
		});
		// echartsMap 将坐标信息和对应物理量的值合在一起
		const convertData = (data) => {
			let res = [];
			for (let i = 0; i < data.length; i++) {
				let geoCoord = state.echartsMapData[data[i].name];
				if (geoCoord) {
					res.push({
						name: data[i].name,
						value: geoCoord.concat(data[i].value),
					});
				}
			}
			return res;
		};
		// 初始化 echartsMap
		const initEchartsMap = () => {
			const myChart = echarts.init(document.getElementById('echartsMap'), 'light');
			state.myChart = myChart;
			const option = {
				tooltip: {
					trigger: 'item',
					formatter: function (params, ticket, callback) {
						return params.data.htmlcontentstr;
						//   callback(ticket, html) //返回自定义内容
					},
				},
				color: ['#FF0000', '#ea7ccc'],
				bmap: {
					center: [window['gLongitudeVal'], window['gLatitudeVal']],
					zoom: window['bdmapLevel'],
					roam: true,
					mapStyle: {},
				},
				series: [
					{
						name: '调度中',
						type: 'lines',
						coordinateSystem: 'bmap',
						polyline: true,
						data: state.schemelines,
						silent: false,
						lineStyle: {
							// color: '#c23531',
							// color: 'rgb(200, 35, 45)',
							opacity: 0.2,
							width: 10,
						},
						progressiveThreshold: 500,
						progressive: 200,
					},
					{
						name: '调度中ing',
						type: 'lines',
						coordinateSystem: 'bmap',
						polyline: true,
						silent: true,
						data: state.schemelines,
						lineStyle: {
							width: 0,
						},
						effect: {
							symbol: 'arrow',
							constantSpeed: 40,
							show: true,
							trailLength: 0.9,
							symbolSize: 10,
							loop: true,
						},
						zlevel: 1,
					},
					{
						name: '集结点',
						type: 'scatter',
						coordinateSystem: 'bmap',
						data: state.jijieDian,
						symbolSize: [51 / 2, 76 / 2],
						encode: {
							value: 2,
						},
						label: {
							formatter: '{b}',
							position: 'right',
							show: true,
							color: '#ff0000',
							fontSize: 14,
						},
					},
					{
						name: '经济目标',
						type: 'scatter',
						coordinateSystem: 'bmap',
						data: state.jingjiDian,
						symbolSize: [51 / 2, 76 / 2],
						encode: {
							value: 2,
						},
						label: {
							formatter: '{b}',
							position: 'right',
							show: true,
							color: '#ff0000',
							fontSize: 14,
						},
					},
					{
						name: '物资点',
						type: 'scatter',
						coordinateSystem: 'bmap',
						data: state.wuziDian,
						symbolSize: [51 / 2, 76 / 2],
						encode: {
							value: 2,
						},
						label: {
							formatter: '{b}',
							position: 'right',
							show: true,
							color: '#ff0000',
							fontSize: 14,
						},
					},
					{
						name: '队伍点',
						type: 'scatter',
						coordinateSystem: 'bmap',
						data: state.zhanyeDian,
						symbolSize: [51 / 2, 76 / 2],
						encode: {
							value: 2,
						},
						label: {
							formatter: '{b}',
							position: 'right',
							show: true,
							color: '#ff0000',
							fontSize: 14,
						},
					},
					{
						name: '人防点',
						type: 'scatter',
						coordinateSystem: 'bmap',
						data: state.zhihuiDian,
						symbolSize: [51 / 2, 76 / 2],
						encode: {
							value: 2,
						},
						label: {
							formatter: '{b}',
							position: 'right',
							show: true,
							color: '#ff0000',
							fontSize: 14,
						},
					},
					{
						name: '防空警报点',
						type: 'scatter',
						coordinateSystem: 'bmap',
						data: state.baozhangDian,
						symbolSize: [51 / 2, 76 / 2],
						encode: {
							value: 2,
						},
						label: {
							formatter: '{b}',
							position: 'right',
							show: true,
							color: '#ff0000',
							fontSize: 14,
						},
					},
					{
						name: '保障点',
						type: 'scatter',
						coordinateSystem: 'bmap',
						data: state.supportDian,
						symbolSize: [51 / 2, 76 / 2],
						encode: {
							value: 2,
						},
						label: {
							formatter: '{b}',
							position: 'right',
							show: true,
							color: '#ff0000',
							fontSize: 14,
						},
					},
					{
						name: '路线点',
						type: 'scatter',
						coordinateSystem: 'bmap',
						data: state.luxianDian,
						symbol: 'image://static/images/end_e68ad9a.png',
						symbolSize: 10,
						encode: {
							value: 2,
						},
						label: {
							formatter: '{b}',
							//position: 'right',
							position: 'top',
							show: false,
							color: '#ff0000',
							fontSize: 14,
						},
					},
					{
						name: '疏散地域点',
						type: 'scatter',
						coordinateSystem: 'bmap',
						data: state.shusandiyuDian,
						symbolSize: [51 / 2, 76 / 2],
						encode: {
							value: 2,
						},
						label: {
							formatter: '{b}',
							position: 'right',
							show: true,
							color: '#ff0000',
							fontSize: 14,
						},
					},
					{
						name: '隐蔽地域点',
						type: 'scatter',
						coordinateSystem: 'bmap',
						data: state.yinbidiyuDian,
						symbolSize: [51 / 2, 76 / 2],
						encode: {
							value: 2,
						},
						label: {
							formatter: '{b}',
							position: 'right',
							show: true,
							color: '#ff0000',
							fontSize: 14,
						},
					},
					{
						name: '疏散路线',
						type: 'lines',
						coordinateSystem: 'bmap',
						polyline: true,
						// 统一的样式设置
						lineStyle: {
							color: '#00ff00',
							width: 3,
							type: 'dashed',
						},
						data: state.shusanLuxianData,
						effect: {
							symbol: 'arrow',
							constantSpeed: 40,
							show: true,
							trailLength: 0.45,
							symbolSize: 10,
							loop: true,
						},
						zlevel: 1,
					},
					{
						name: '疏散地域',
						type: 'lines',
						coordinateSystem: 'bmap',
						polyline: true,
						// 统一的样式设置
						lineStyle: {
							color: '#0000ff',
							opacity: 0.6,
							width: 15,
						},
						data: state.shusanDiyuData,
					},
					{
						name: '隐蔽地域',
						type: 'lines',
						coordinateSystem: 'bmap',
						polyline: true,
						// 统一的样式设置
						lineStyle: {
							color: '#ff0000',
							opacity: 0.6,
							width: 15,
						},
						data: state.yinbiDiyuData,
					},
				],
			};
			myChart.setOption(option, true);
			window.addEventListener('resize', () => {
				myChart.resize();
			});
			//lhc added
			//init
			state.curSearchPoint = new BMap.Point();
			state.curSearchMarker = new BMap.Marker();
			state.startGhLuxianPoint = new BMap.Point();
			state.endGhLuxianPoint = new BMap.Point();
			// 从echarts对象中获取bmap对象
			const bmap = (state.bmap = myChart.getModel().getComponent('bmap').getBMap());
			bmap.setMinZoom(10);
			bmap.setMaxZoom(window['bdmapLevel']);
			bmap.addEventListener('click', function (e) {
				if (state.showToolsBox) {
					if (state.isMarkActive) {
						// state.isMarkActive = false;
						if (toolOptValue.value.substring(1) == '集结点') {
							state.jijieDian.push({
								name: '',
								value: [e.point.lng, e.point.lat, undefined],
								...AllMap.jijieDefaultParam,
							});
							myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '集结点',
										data: state.jijieDian,
									},
								],
							});
							//显示对话框
							editDialogShowByLoc(e.offsetX, e.offsetY);
							resetTempArticleModel();
							return;
						}
						if (toolOptValue.value.substring(1) == '防空警报点') {
							state.baozhangDian.push({
								name: '',
								value: [e.point.lng, e.point.lat, undefined],
								...AllMap.baozhangDefaultParam,
							});
							myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '防空警报点',
										data: state.baozhangDian,
									},
								],
							});
							//显示对话框
							editDialogShowByLoc(e.offsetX, e.offsetY);
							resetTempArticleModel();
							return;
						}
						if (toolOptValue.value.substring(1) == '保障点') {
							state.supportDian.push({
								name: '',
								value: [e.point.lng, e.point.lat, undefined],
								...AllMap.supportDefaultParam,
							});
							myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '保障点',
										data: state.supportDian,
									},
								],
							});
							//显示对话框
							editDialogShowByLoc(e.offsetX, e.offsetY);
							resetTempArticleModel();
							return;
						}
						if (toolOptValue.value.substring(1) == '物资点') {
							state.wuziDian.push({
								name: '',
								value: [e.point.lng, e.point.lat, undefined],
								...AllMap.wuziDefaultParam,
							});
							myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '物资点',
										data: state.wuziDian,
									},
								],
							});
							//显示对话框-
							// editDialogShowByLoc(e.offsetX, e.offsetY);
							// resetTempArticleModel();
							state.zhanbeiVisible = true;
							state.zhanbeiDialogStatus = 'create';
							(dialogPop as any).value.handleCreate();
							return;
						}
						if (toolOptValue.value.substring(1) == '队伍点') {
							state.zhanyeDian.push({
								name: '',
								value: [e.point.lng, e.point.lat, undefined],
								...AllMap.duiwuDefaultParam,
							});
							myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '队伍点',
										data: state.zhanyeDian,
									},
								],
							});
							//显示对话框
							// editDialogShowByLoc(e.offsetX, e.offsetY);
							// resetTempArticleModel();
							state.zhuanyeVisible = true;
							state.zhuanyeDialogStatus = 'create';
							(zhuanyedialogPop as any).value.handleCreate();
							return;
						}
						if (toolOptValue.value.substring(1) == '人防点') {
							state.zhihuiDian.push({
								name: '',
								value: [e.point.lng, e.point.lat, undefined],
								...AllMap.zhihuiDefaultParam,
							});
							myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '人防点',
										data: state.zhihuiDian,
									},
								],
							});
							//显示对话框
							// editDialogShowByLoc(e.offsetX, e.offsetY);
							// resetTempArticleModel();
							state.zhihuiVisible = true;
							state.zhihuiDialogStatus = 'create';
							(zhihuidialogPop as any).value.handleCreate();
							return;
						}
						if (toolOptValue.value.substring(1) == '经济目标') {
							state.jingjiDian.push({
								name: '',
								value: [e.point.lng, e.point.lat, undefined],
								...AllMap.jingjiDefaultParam,
							});
							myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '经济目标',
										data: state.jingjiDian,
									},
								],
							});
							//显示对话框
							// editDialogShowByLoc(e.offsetX, e.offsetY);
							// resetTempArticleModel();
							state.jingjiVisible = true;
							state.jingjiDialogStatus = 'create';
							(jingjidialogPop as any).value.handleCreate();
							return;
						}
						ElMessage.error('标注仅用于点,路线/区域请点击手绘');
						return;
					}
					state.showToolsBox = false;
				} else if (state.showLuxian) {
					let subitem = {
						address: '[' + e.point.lng + ',' + e.point.lat + ']',
						longitude: e.point.lng,
						latitude: e.point.lat,
					};
					if (state.isStartLuxianFocus) {
						setQizhongdianInput(subitem);
					} else if (state.isEndLuxianFocus) {
						setQizhongdianInput(subitem);
					}
				} else if (state.isShouhuiActive) {
					if (toolOptValue.value.substring(1) == '疏散路线') {
						state.currentLxDian.push({
							name: dftSeriesLinesData.name,
							value: [e.point.lng, e.point.lat],
						});
						if (state.currentLxDian.length == 1) {
							state.luxianDian.push({
								name: dftSeriesLinesData.name,
								value: [e.point.lng, e.point.lat],
								label: { show: true },
							});
						} else {
							state.luxianDian.push({
								name: dftSeriesLinesData.name,
								value: [e.point.lng, e.point.lat],
							});
						}
						myChart.setOption({
							series: [
								{
									// 根据名字对应到相应的系列
									name: '路线点',
									data: state.luxianDian,
								},
							],
						});
						if (state.currentLxDian.length > 1) {
							if (state.currentLxDian.length == 2) {
								let currentLuxianData = cloneDeep(dftSeriesLinesData);
								state.currentLxDian.forEach((ele) => {
									currentLuxianData.coords.push(ele.value);
								});
								state.shusanLuxianData.push(currentLuxianData);
							} else {
								state.shusanLuxianData.forEach((ele) => {
									if (ele.name == dftSeriesLinesData.name) {
										ele.coords.push([e.point.lng, e.point.lat]);
									}
								});
							}
							myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '疏散路线',
										data: state.shusanLuxianData,
									},
								],
							});
						}
					} else {
						ElMessage.error('点击仅用于疏散路线,区域请按住鼠标左键拖动');
					}
				}
			});
			bmap.addEventListener('rightclick', function (e) {
				if (isContextMenu) {
					isContextMenu = false;
					return;
				}
				isContextMenu = false;
				if (state.isShouhuiActive) {
					// state.isShouhuiActive = false;
					state.currentLxDian = [];
					/*
		    		nextTick(() => {	    							
	          			state.bmap.enableDoubleClickZoom();
	        		});
	        		*/
					//显示对话框
					editDialogShowByLoc(e.offsetX, e.offsetY);
					resetTempArticleModel();
					return;
				}
				// state.addsearchName = '';
				// state.searchDianPopVisible = true;
				// addSearchPos.lng = e.point.lng;
				// addSearchPos.lat = e.point.lat;
				if (movePnt.name && movePnt.seriesName) {
					setTimeout(async () => {
						let res: any = null;
						if ('物资点' == movePnt.seriesName)
							res = await HttpReqApi.editLocWuzi(movePnt.name, movePnt.seriesName, e.point.lng + '', e.point.lat + '');
						else if ('人防点' == movePnt.seriesName)
							res = await HttpReqApi.editLocRenFang(movePnt.name, movePnt.seriesName, e.point.lng + '', e.point.lat + '');
						else if ('队伍点' == movePnt.seriesName)
							res = await HttpReqApi.editLocDuiwu(movePnt.name, movePnt.seriesName, e.point.lng + '', e.point.lat + '');
						else res = await HttpReqApi.editLoc(movePnt.name, movePnt.seriesName, e.point.lng + '', e.point.lat + '');
						if (!res) return;
						AllMap.moveOne(state, movePnt.name, movePnt.seriesName, e.point.lng + '', e.point.lat + '');
						movePnt.name = '';
						movePnt.seriesName = '';
					}, 60);
				}
			});
			bmap.addEventListener('mousemove', function (e) {
				if (state.isMouseDown == false) return;
				if (state.isShouhuiActive == false) return;
				debounceUnit.continue(() => {
					if (toolOptValue.value.substring(1) == '隐蔽地域') {
						if (state.currentYbdyDian.length == 0) {
							state.currentYbdyDian.push({
								name: dftSeriesLinesData.name,
								value: [e.point.lng, e.point.lat],
							});
							state.yinbidiyuDian.push({
								name: dftSeriesLinesData.name,
								value: [e.point.lng, e.point.lat, undefined],
							});
							myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '隐蔽地域点',
										data: state.yinbidiyuDian,
									},
								],
							});
							return;
						}
						let startDian = state.currentYbdyDian[0];
						let isDeal = false;
						state.yinbiDiyuData.forEach((ele) => {
							if (ele.name == dftSeriesLinesData.name) {
								ele.coords.splice(
									1,
									4,
									[e.point.lng, startDian.value[1]],
									[e.point.lng, e.point.lat],
									[startDian.value[0], e.point.lat],
									startDian.value
								);
								isDeal = true;
								myChart.setOption({
									series: [
										{
											// 根据名字对应到相应的系列
											name: '隐蔽地域',
											data: state.yinbiDiyuData,
										},
									],
								});
							}
						});
						if (isDeal) return;
						let currentYbdyData = cloneDeep(dftSeriesLinesData);
						currentYbdyData.coords.push(
							startDian.value,
							[e.point.lng, startDian.value[1]],
							[e.point.lng, e.point.lat],
							[startDian.value[0], e.point.lat],
							startDian.value
						);
						state.yinbiDiyuData.push(currentYbdyData);
						myChart.setOption({
							series: [
								{
									// 根据名字对应到相应的系列
									name: '隐蔽地域',
									data: state.yinbiDiyuData,
								},
							],
						});
						return;
					}
					if (toolOptValue.value.substring(1) == '疏散地域') {
						if (state.currentSsdyDian.length == 0) {
							state.currentSsdyDian.push({
								name: dftSeriesLinesData.name,
								value: [e.point.lng, e.point.lat],
							});
							state.shusandiyuDian.push({
								name: dftSeriesLinesData.name,
								value: [e.point.lng, e.point.lat],
							});
							myChart.setOption({
								series: [
									{
										// 根据名字对应到相应的系列
										name: '疏散地域点',
										data: state.shusandiyuDian,
									},
								],
							});
							return;
						}
						let startDian = state.currentSsdyDian[0];
						let isDeal = false;
						state.shusanDiyuData.forEach((ele) => {
							if (ele.name == dftSeriesLinesData.name) {
								ele.coords.splice(
									1,
									4,
									[e.point.lng, startDian.value[1]],
									[e.point.lng, e.point.lat],
									[startDian.value[0], e.point.lat],
									startDian.value
								);
								isDeal = true;
								myChart.setOption({
									series: [
										{
											// 根据名字对应到相应的系列
											name: '疏散地域',
											data: state.shusanDiyuData,
										},
									],
								});
							}
						});
						if (isDeal) return;
						let currentSsdyData = cloneDeep(dftSeriesLinesData);
						currentSsdyData.coords.push(
							startDian.value,
							[e.point.lng, startDian.value[1]],
							[e.point.lng, e.point.lat],
							[startDian.value[0], e.point.lat],
							startDian.value
						);
						state.shusanDiyuData.push(currentSsdyData);
						myChart.setOption({
							series: [
								{
									// 根据名字对应到相应的系列
									name: '疏散地域',
									data: state.shusanDiyuData,
								},
							],
						});
						return;
					}
				});
			});
			bmap.addEventListener('zoomend', function () {
				var currentZoom = bmap.getZoom(); // 获取当前地图的缩放等级
			});
			myChart.getZr().on('mousedown', (e) => {
				if (toolOptValue.value.substring(1) != '疏散地域' && toolOptValue.value.substring(1) != '隐蔽地域') return;
				if (state.isShouhuiActive == false) return;
				state.bmap.disableDragging();
				state.isMouseDown = true;
			});
			myChart.getZr().on('mouseup', (e) => {
				if (state.isShouhuiActive) {
					if (toolOptValue.value.substring(1) == '疏散地域' || toolOptValue.value.substring(1) == '隐蔽地域') {
						state.isShouhuiActive = false;
						state.bmap.enableDragging();
						state.isMouseDown = false;
						state.currentSsdyDian = [];
						state.currentYbdyDian = [];
						//显示对话框
						editDialogShowByLoc(e.offsetX, e.offsetY);
						resetTempArticleModel();
					}
				}
			});
			myChart.on('contextmenu', (e) => {
				isContextMenu = true;
				if (e.seriesName?.indexOf('调度') != -1) {
					let schemeval = e.data.schemeval;
					const { clientX, clientY } = e;
					state.dropdownNode.x = e.event?.event.clientX;
					state.dropdownNode.y = e.event?.event.clientY;
					(contextmenuNodeRef as any).value.openContextmenu({ type: 'node', status: '方案|方案', name: schemeval, seriesName: e.seriesName });
					return;
				}
				const { clientX, clientY } = e;
				state.dropdownNode.x = e.event?.event.clientX;
				state.dropdownNode.y = e.event?.event.clientY;
				(contextmenuNodeRef as any).value.openContextmenu({ type: 'node', status: e.data.status, name: e.name, seriesName: e.seriesName });
			});
			myChart.on('click', (e) => {
				if (schemeBack != null) {
					AllMap.schemeUnSelectDian(schemeBack, state, optValueBefore);
					let backdian = schemeBack.backdian;
					schemeBack = null;
					let startPoint = backdian.value;
					if (toolOptValue.value == '加方案') {
						if (!e.data || !e.data.status) return;
						if (!e.seriesName) return;
						if (e.seriesName.indexOf('点') == -1 && e.seriesName != '经济目标') return;
						let arr = e.data.status.split('|');
						if (arr.length > 1) {
							let name = e.data.name;
							let secondPoint = AllMap.schemeSecondPoint(e.seriesName, name, e.data.luIndex, state);
							if (secondPoint != null) {
								if (secondPoint.join() == startPoint.join()) return;
								state.schemelines.push({
									status: '方案',
									coords: [[...startPoint], [...secondPoint]],
									lineStyle: { normal: { color: 'rgba(223,90,90,1)' } },
									schemeval: Math.random() + '',
								});
								AllMap.displaySchemeLines(state);
							}
							return;
						}
					}
					return;
				}
				if (toolOptValue.value == '加方案') {
					if (!e.data || !e.data.status) return;
					if (!e.seriesName) return;
					if (e.seriesName.indexOf('点') == -1 && e.seriesName != '经济目标') return;
					let arr = e.data.status.split('|');
					if (arr.length > 1) {
						let name = e.data.name;
						if (schemeBack == null) {
							schemeBack = AllMap.schemeSelectDian(e.seriesName, name, e.data.luIndex, state, optValueBefore);
							return;
						}
						return;
					}
					return;
				}
				for (let i = 0; i < state.getTblData.data.length; i++) {
					let ele = state.getTblData.data[i];
					if (ele.title == e.name) {
						console.log(ele.title,e.seriesName);
						if (e.seriesName == '物资点') {
							state.zhanbeiVisible = true;
							state.zhanbeiDialogStatus = 'update';
							state.uptDelContext = e;
							(dialogPop as any).value.handleUpdate(ele, true);
							return;
						}
						if (e.seriesName == '队伍点') {
							state.zhuanyeVisible = true;
							state.zhuanyeDialogStatus = 'update';
							state.uptDelContext = e;
							(zhuanyedialogPop as any).value.handleUpdate(ele, true);
							return;
						}
						if (e.seriesName == '人防点') {
							state.zhihuiVisible = true;
							state.zhihuiDialogStatus = 'update';
							state.uptDelContext = e;
							(zhihuidialogPop as any).value.handleUpdate(ele, true);
							return;
						}
						if (e.seriesName == '经济目标') {
							state.jingjiVisible = true;
							state.jingjiDialogStatus = 'update';
							state.uptDelContext = e;
							(jingjidialogPop as any).value.handleUpdate(ele, true);
							return;
						}
						if(e.seriesName== '防空警报点'){
							state.jingbaoqiUpdate = true;
						}
						state.tempArticleModel = cloneDeep(ele);
						state.dialogStatus = 'update';
						editDialogShowByLoc(e.event.offsetX, e.event.offsetY);
						state.uptDelContext = e;
						break;
					}
				}
			});
			//test start
			//test end
		};
		//挂图 —— 警报点、人防工程点、疏散点
		const wallMap = () => {
			AllMap.getWallMapPoit(state);
			let alarm_point = state.treeArr[0].children[5].children;
			// let evacuate_point = [...state.treeArr[0].children[5],...state.treeArr[0].children[1],...state.treeArr[0].children[3],...state.treeArr[0].children[4]]
			let wallMapPoint = [...alarm_point];
		};
		// 页面加载时
		onMounted(async () => {
			AllMap.clear();
			(state.expandedArr as any).push(state.treeArr[0].id);
			await initEchartsMap();
			wallMap();
			loadTypeName();
			//寿县行政区域边界线 ref:https://www.xiaoguo123.com/p/baidumap-xingzhengquyu/
			var prov_area = new BMap.Polyline(prov_boundary, { strokeWeight: 2, strokeColor: '#ff0000' });
			state.bmap.addOverlay(prov_area);
		});
		onUnmounted(() => {
			state.myChart.dispose();
		});
		return {
			initTagViewHeight,
			...toRefs(state),
			changeRouteIndex,
			searchAddr,
			clickGhLuxian,
			setSearchInput,
			setQizhongdianInput,
			startGhLuxianFocus,
			endGhLuxianFocus,
			searchBoxFocus,
			closeSearchContent,
			t,
			handleDelete,
			createData,
			updateData,
			setSelectItem,
			optValue,
			toolOptValue,
			onChangeOpt,
			onChangeToolOpt,
			dialogPop,
			updateZhanbei,
			createZhanbei,
			clearNewZhanbei,
			delZhanbei,
			zhuanyedialogPop,
			createZhuanye,
			updateZhuanye,
			delZhuanye,
			clearNewZhuanye,
			delZhihui,
			updateZhihui,
			createZhihui,
			clearNewZhihui,
			zhihuidialogPop,
			jingjidialogPop,
			clearNewJIngji,
			createJingji,
			updateJingji,
			delJingji,
			tapAddSearchDian,
			contextmenuNodeRef,
			onRightMenu,
			addScheme,
			shcemedialogPop,
			createScheme,
			saveScheme,
			updateScheme,
			handleCheckChange,
			handleTreeContextMenu,
			onOpenDrawer,
			checkChange,
			jingbaoqiWeizhi,
		};
	},
};
</script>
<style lang="scss" scoped>
::v-deep .el-select-dropdown__wrap {
	max-height: 100% !important;
}
::v-deep .mask-layer {
	width: 200px !important;
	inset: unset !important;
	bottom: 0px;
	height: 100%;
	top: 0px;
	right: 0px;
	pointer-events: auto;
}
::v-deep .el-drawer {
	width: 100%;
}
.appRightTop {
	z-index: 4;
	position: absolute;
	top: 20px;
	right: 200px;
}
</style>
